@arcgis/core 4.28.0-next.20230920 → 4.28.0-next.20230921

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 (146) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
  4. package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
  5. package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{b558a402e2ce2616cf37.js → 3ca759f72d3bb29e9ea9.js} +22 -22
  8. package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
  9. package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
  10. package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
  11. package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
  12. package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7c72d5368bb2d7484b9b.js → 580039dd491854ca325c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
  15. package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
  16. package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
  17. package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
  18. package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
  19. package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
  20. package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
  21. package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
  22. package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
  23. package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
  24. package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
  25. package/assets/esri/core/workers/chunks/{aa021bc97b4a18a749dd.js → cad260881653567bc8f9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
  27. package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
  28. package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
  29. package/assets/esri/core/workers/chunks/{9c40e7ed387071544f8c.js → ed1fbc1bc8d50453e2f5.js} +1 -1
  30. package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
  31. package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
  32. package/chunks/LaserlinePath.glsl.js +5 -1
  33. package/core/sql.js +1 -1
  34. package/interfaces.d.ts +1 -17
  35. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  36. package/layers/mixins/SceneService.js +1 -1
  37. package/layers/save/utils.js +1 -1
  38. package/layers/support/editableLayers.js +1 -1
  39. package/package.json +1 -1
  40. package/portal/PortalItem.js +1 -1
  41. package/rest/geometryService/cut.js +1 -1
  42. package/rest/query/operations/query.js +1 -1
  43. package/rest/versionManagement/deleteVersion.js +1 -1
  44. package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
  45. package/rest/versionManagement/gdbVersion/post.js +1 -1
  46. package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
  47. package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
  48. package/support/revision.js +1 -1
  49. package/views/2d/engine/Stage.js +1 -1
  50. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  51. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  52. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  53. package/views/3d/environment/LocalAtmosphere.js +1 -1
  54. package/views/3d/interactive/manipulatorUtils.js +1 -1
  55. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  56. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  57. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  58. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  59. package/views/3d/layers/MediaLayerView3D.js +1 -1
  60. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  61. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  62. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  67. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  68. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  69. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  70. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  71. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  72. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  73. package/views/3d/layers/support/patternUtils.js +1 -1
  74. package/views/3d/support/dito.js +1 -1
  75. package/views/3d/support/engineContent/line.js +1 -1
  76. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  77. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  78. package/views/3d/terrain/TerrainRenderer.js +1 -1
  79. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  80. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  81. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
  82. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  83. package/views/3d/webgl-engine/lib/Attribute.js +1 -1
  84. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  85. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  86. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  87. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  88. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  89. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  90. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  91. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  92. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  93. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  94. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  95. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  98. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  99. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  100. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  102. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  103. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  104. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  106. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  107. package/views/draw/DrawGraphicTool.js +1 -1
  108. package/views/interactive/keybindings.js +1 -1
  109. package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
  110. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  111. package/views/interactive/tooltip/content/Fields.js +5 -0
  112. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  113. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  114. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  115. package/webdoc/saveAPIKeyUtils.js +5 -0
  116. package/webdoc/webdocSaveUtils.js +1 -1
  117. package/widgets/BasemapGallery.js +1 -1
  118. package/widgets/BasemapLayerList.js +1 -1
  119. package/widgets/Expand.js +1 -1
  120. package/widgets/Feature/FeatureRelationship.js +1 -1
  121. package/widgets/Fullscreen.js +1 -1
  122. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  123. package/widgets/Swipe.js +1 -1
  124. package/widgets/support/globalCss.js +1 -1
  125. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
  126. package/assets/esri/core/workers/chunks/084a85e2e31b4d5fa924.js +0 -1
  127. package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
  128. package/assets/esri/core/workers/chunks/21f0fafafcd754f5fb88.js +0 -1
  129. package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
  130. package/assets/esri/core/workers/chunks/2bf58296a6ea4eee960b.js +0 -1
  131. package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
  132. package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
  133. package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
  134. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
  135. package/assets/esri/core/workers/chunks/74ddc14e4b576ddbb582.js +0 -1
  136. package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
  137. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
  138. package/assets/esri/core/workers/chunks/a838dc6653ec29503053.js +0 -1
  139. package/assets/esri/core/workers/chunks/b10a91cae610aba62bf8.js +0 -1
  140. package/assets/esri/core/workers/chunks/b8eb842ea98a9734e161.js +0 -1
  141. package/assets/esri/core/workers/chunks/bbb63392485ed57703e0.js +0 -1
  142. package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
  143. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
  144. package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
  145. package/assets/esri/core/workers/chunks/e5fcfd41f0ec12dcb7f2.js +0 -1
  146. package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3831,2664],{65845:(e,t,r)=>{r.d(t,{D:()=>o});var n=r(81153);function o(e){e&&e.writtenProperties&&e.writtenProperties.forEach((({target:e,propName:t,newOrigin:r})=>{(0,n.l)(e)&&r&&e.originOf(t)!==r&&e.updateOrigin(t,r)}))}},81153:(e,t,r)=>{function n(e){return e&&"getAtOrigin"in e&&"originOf"in e}r.d(t,{l:()=>n})},32664:(e,t,r)=>{r.d(t,{save:()=>S,saveAs:()=>N});var n=r(67676),o=(r(20102),r(19238)),a=r(64383),i=r(66677),s=r(52104),l=r(84230),u=(r(33516),r(14661));const p="Feature Service",y="feature-layer-utils",c=`${y}-save`,f=`${y}-save-as`;function m(e){return{isValid:(0,l.fP)(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function d(e){const t=[],r=[];for(const{layer:n,layerJSON:o}of e)n.isTable?r.push(o):t.push(o);return{layers:t,tables:r}}function h(e){return d([e])}async function g(e,t){return/\/\d+\/?$/.test(e.url)?h(t[0]):async function(e,t){if(!t)return d(e);const{layer:{url:r,customParameters:n,apiKey:a}}=e[0];let i=await t.fetchData("json");i&&null!=i.layers&&null!=i.tables||(i=await async function(e,t,r){e||={},e.layers||=[],e.tables||=[];const{url:n,customParameters:a,apiKey:i}=t,{serviceJSON:l,layersJSON:u}=await(0,s.V)(n,{customParameters:a,apiKey:i}),p=w(e.layers,l.layers,r),y=w(e.tables,l.tables,r);e.layers=p.itemResources,e.tables=y.itemResources;const c=[...p.added,...y.added],f=u?[...u.layers,...u.tables]:[];return await async function(e,t,r,n){const a=t.map((({id:e})=>new o.default({url:r,layerId:e,sourceJSON:n.find((({id:t})=>t===e))})));await Promise.allSettled(a.map((e=>e.load()))),a.forEach((t=>{const{layerId:r,loaded:n,defaultPopupTemplate:o}=t;n&&null!=o&&v(t,{id:r,popupInfo:o.toJSON()},e)}))}(e,c,n,f),e}(i,{url:r??"",customParameters:n,apiKey:a},e.map((e=>e.layer.layerId))));for(const t of e)v(t.layer,t.layerJSON,i);return i}(t,e)}function w(e,t,r){const o=(0,n.e5)(e,t,((e,t)=>e.id===t.id));e=e.filter((e=>!o.removed.some((t=>t.id===e.id))));const a=o.added.map((({id:e})=>({id:e})));return a.forEach((({id:t})=>{e.push({id:t})})),{itemResources:e,added:a.filter((({id:e})=>!r.includes(e)))}}function v(e,t,r){e.isTable?b(r.tables,t):b(r.layers,t)}function b(e,t){const r=e.findIndex((({id:e})=>e===t.id));-1===r?e.push(t):e[r]=t}async function x(e,t){const{url:r,layerId:n,title:o,fullExtent:a,isTable:s}=e,l=(0,i.Qc)(r);t.url="FeatureServer"===l?.serverType?r:`${r}/${n}`,t.title||=o,t.extent=null,s||null==a||(t.extent=await(0,u.$o)(a)),(0,u.ck)(t,u.Kz.METADATA),(0,u.ck)(t,u.Kz.MULTI_LAYER),(0,u.qj)(t,u.Kz.SINGLE_LAYER),s&&(0,u.qj)(t,u.Kz.TABLE)}async function S(e,t){return(0,a.a1)({layer:e,itemType:p,validateLayer:m,createItemData:(e,t)=>g(t,[e]),errorNamePrefix:c},t)}async function N(e,t,r){return(0,a.po)({layer:e,itemType:p,validateLayer:m,createItemData:(e,t)=>Promise.resolve(h(e)),errorNamePrefix:f,newItem:t,setItemProperties:x},r)}},64383:(e,t,r)=>{r.d(t,{a1:()=>h,po:()=>g});var n=r(20102),o=r(65845),a=r(48522),i=r(15235),s=r(33516),l=r(14661);async function u(e){const{layer:t,errorNamePrefix:r,validateLayer:o}=e;await t.load(),function(e,t,r){const o=r(e);if(!o.isValid)throw new n.Z(`${t}:invalid-parameters`,o.errorMessage,{layer:e})}(t,r,o)}function p(e,t){return`Layer (title: ${e.title}, id: ${e.id}) of type '${e.declaredClass}' ${t}`}function y(e,t,r,o){if(e.type!==r)throw new n.Z(`${t}:portal-item-wrong-type`,`Portal item type should be "${r}"`,{item:e,layer:o})}function c(e,t,r){const{portalItem:o}=e;if(!o)throw new n.Z(`${t}:portal-item-not-set`,p(e,"requires the portalItem property to be set"));if(!o.loaded)throw new n.Z(`${t}:portal-item-not-loaded`,p(e,"cannot be saved to a portal item that does not exist or is inaccessible"));y(o,t,r,e)}function f(e,t,r,n){let o=i.default.from(e);return o.id&&(o=o.clone(),o.id=null),o.type??=r,o.portal??=a.Z.getDefault(),y(o,t,r,n),o}async function m(e,t,r){"beforeSave"in e&&"function"==typeof e.beforeSave&&await e.beforeSave();const o=e.write({},t);return function(e,t){let r=(e.messages??[]).filter((({type:e})=>"error"===e)).map((({name:e,message:t,details:r})=>new n.Z(e,t,r)));if(t?.ignoreUnsupported&&(r=r.filter((({name:e})=>"layer:unsupported"!==e&&"symbol:unsupported"!==e&&"symbol-layer:unsupported"!==e&&"property:unsupported"!==e&&"url:unsupported"!==e))),r.length>0)throw new n.Z("layer-write:unsupported","Failed to save layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}(t,r),o}function d(e){(0,l.qj)(e,l.Kz.JSAPI),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}async function h(e,t){const{layer:r,createItemData:n,errorNamePrefix:a,itemType:i}=e;await u(e),c(r,a,i);const l=r.portalItem,p=(0,s.Y)(l),y=await m(r,p,t),f=await n({layer:r,layerJSON:y},l);return d(l),await l.update({data:f}),(0,o.D)(p),l}async function g(e,t){const{layer:r,createItemData:n,setItemProperties:a,newItem:i,errorNamePrefix:l,itemType:p}=e;await u(e);const y=f(i,l,p,r),c=(0,s.Y)(y),h=await m(r,c,t),g=await n({layer:r,layerJSON:h},y);return await a(r,y),d(y),await async function(e,t,r){const n=e.portal;await n.signIn(),await(n.user?.addItem({item:e,data:t,folder:r?.folder}))}(y,g,t),r.portalItem=y,(0,o.D)(c),y}},16451:(e,t,r)=>{r.d(t,{Z:()=>f});var n=r(43697),o=r(2368),a=r(96674),i=r(5600),s=(r(75215),r(67676),r(80442),r(71715)),l=r(52011),u=r(30556),p=r(72729),y=r(70082);let c=class extends((0,o.J)(a.wq)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,p.im)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,n._)([(0,i.Cb)({json:{write:!0}})],c.prototype,"id",void 0),(0,n._)([(0,i.Cb)({json:{write:!0}})],c.prototype,"name",void 0),(0,n._)([(0,i.Cb)({json:{write:!0}})],c.prototype,"domains",void 0),(0,n._)([(0,s.r)("domains")],c.prototype,"readDomains",null),(0,n._)([(0,u.c)("domains")],c.prototype,"writeDomains",null),(0,n._)([(0,i.Cb)({type:[y.Z],json:{write:!0}})],c.prototype,"templates",void 0),c=(0,n._)([(0,l.j)("esri.layers.support.FeatureType")],c);const f=c},52104:(e,t,r)=>{r.d(t,{V:()=>o});var n=r(96187);async function o(e,t){const r=await(0,n.T)(e,t);r.layers=r.layers.filter(a);const o={serviceJSON:r};if((r.currentVersion??0)<10.5)return o;const i=await(0,n.T)(e+"/layers",t);return o.layersJSON={layers:i.layers.filter(a),tables:i.tables},o}function a(e){return!e.type||"Feature Layer"===e.type||"Oriented Imagery Layer"===e.type}},33516:(e,t,r)=>{r.d(t,{Y:()=>i,h:()=>a});var n=r(17452),o=r(48522);function a(e){return{origin:"portal-item",url:(0,n.mN)(e.itemUrl),portal:e.portal||o.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function i(e){return{origin:"portal-item",messages:[],writtenProperties:[],url:e.itemUrl?(0,n.mN)(e.itemUrl):null,portal:e.portal||o.Z.getDefault(),portalItem:e}}},28694:(e,t,r)=>{r.d(t,{p:()=>o});var n=r(69285);function o(e,t,r){if(!r||!r.features||!r.hasZ)return;const o=(0,n.k)(r.geometryType,t,e.outSpatialReference);if(null!=o)for(const e of r.features)o(e.geometry)}},74889:(e,t,r)=>{r.d(t,{Z:()=>v});var n,o=r(43697),a=r(66577),i=r(38171),s=r(35454),l=r(96674),u=r(22974),p=r(5600),y=(r(75215),r(71715)),c=r(52011),f=r(30556),m=r(82971),d=r(33955),h=r(1231);const g=new s.X({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let w=n=class extends l.wq{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const r=m.Z.fromJSON(t.spatialReference),n=[];for(let t=0;t<e.length;t++){const o=e[t],a=i.Z.fromJSON(o),s=o.geometry&&o.geometry.spatialReference;null==a.geometry||s||(a.geometry.spatialReference=r);const l=o.aggregateGeometries,u=a.aggregateGeometries;if(l&&null!=u)for(const e in u){const t=u[e],n=l[e],o=n?.spatialReference;null==t||o||(t.spatialReference=r)}n.push(a)}return n}writeGeometryType(e,t,r,n){if(e)return void g.write(e,t,r,n);const{features:o}=this;if(o)for(const e of o)if(e&&null!=e.geometry)return void g.write(e.geometry.type,t,r,n)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,n=(0,d.im)(e);return n&&!r&&t.spatialReference&&(n.spatialReference=m.Z.fromJSON(t.spatialReference)),n}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new n(this.cloneProperties())}cloneProperties(){return(0,u.d9)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const n=t.features[r];if(n.geometry){const t=e&&e[r];n.geometry=t&&t.toJSON()||n.geometry}}return t}quantize(e){const{scale:[t,r],translate:[n,o]}=e,a=this.features,i=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-n)/t)),(e=>Math.round((o-e)/r)));for(let e=0,t=a.length;e<t;e++)i?.(a[e].geometry)||(a.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[n,o],scale:[a,i]}=r;let s=null,l=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;s=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;l=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*a+n),(e=>o-e*i),s,l);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,r){let n,o;const a=[];for(let i=0,s=e.length;i<s;i++){const s=e[i];if(i>0){const e=t(s[0]),i=r(s[1]);e===n&&i===o||(a.push([e-n,i-o]),n=e,o=i)}else n=t(s[0]),o=r(s[1]),a.push([n,o])}return a.length>0?a:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const n=(0,d.oU)(e)?e.rings:e.paths,o=[];for(let e=0,a=n.length;e<a;e++){const a=n[e],i=this._quantizePoints(a,t,r);i&&o.push(i)}return o.length>0?((0,d.oU)(e)?e.rings=o:e.paths=o,e):null}:"multipoint"===e?e=>{const n=this._quantizePoints(e.points,t,r);return n&&n.length>0?(e.points=n,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,n,o){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),n&&(e.z=n(e.z))}:"polyline"===e||"polygon"===e?e=>{const a=(0,d.oU)(e)?e.rings:e.paths;let i,s;for(let e=0,n=a.length;e<n;e++){const n=a[e];for(let e=0,o=n.length;e<o;e++){const o=n[e];e>0?(i+=o[0],s+=o[1]):(i=o[0],s=o[1]),o[0]=t(i),o[1]=r(s)}}if(n&&o)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2]),r[3]=o(r[3])}}else if(n)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2])}}else if(o)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=o(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),n&&null!=e.zmax&&null!=e.zmin&&(e.zmax=n(e.zmax),e.zmin=n(e.zmin)),o&&null!=e.mmax&&null!=e.mmin&&(e.mmax=o(e.mmax),e.mmin=o(e.mmin))}:"multipoint"===e?e=>{const a=e.points;let i,s;for(let e=0,n=a.length;e<n;e++){const n=a[e];e>0?(i+=n[0],s+=n[1]):(i=n[0],s=n[1]),n[0]=t(i),n[1]=r(s)}if(n&&o)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=n(t[2]),t[3]=o(t[3])}else if(n)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=n(t[2])}else if(o)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=o(t[2])}}:null}};(0,o._)([(0,p.Cb)({type:String,json:{write:!0}})],w.prototype,"displayFieldName",void 0),(0,o._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"exceededTransferLimit",void 0),(0,o._)([(0,p.Cb)({type:[i.Z],json:{write:!0}})],w.prototype,"features",void 0),(0,o._)([(0,y.r)("features")],w.prototype,"readFeatures",null),(0,o._)([(0,p.Cb)({type:[h.Z],json:{write:!0}})],w.prototype,"fields",void 0),(0,o._)([(0,p.Cb)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],w.prototype,"geometryType",void 0),(0,o._)([(0,f.c)("geometryType")],w.prototype,"writeGeometryType",null),(0,o._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasM",void 0),(0,o._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasZ",void 0),(0,o._)([(0,p.Cb)({types:a.qM,json:{write:!0}})],w.prototype,"queryGeometry",void 0),(0,o._)([(0,y.r)("queryGeometry")],w.prototype,"readQueryGeometry",null),(0,o._)([(0,p.Cb)({type:m.Z,json:{write:!0}})],w.prototype,"spatialReference",void 0),(0,o._)([(0,f.c)("spatialReference")],w.prototype,"writeSpatialReference",null),(0,o._)([(0,p.Cb)({json:{write:!0}})],w.prototype,"transform",void 0),w=n=(0,o._)([(0,c.j)("esri.rest.support.FeatureSet")],w),w.prototype.toJSON.isDefaultToJSON=!0;const v=w},96187:(e,t,r)=>{r.d(t,{T:()=>o});var n=r(3172);async function o(e,t){const{data:r}=await(0,n.Z)(e,{responseType:"json",query:{f:"json",...t?.customParameters,token:t?.apiKey}});return r}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[300,7873],{92835:(e,t,r)=>{r.d(t,{Z:()=>y});var i,n=r(43697),o=r(96674),s=r(35463),a=r(5600),l=(r(75215),r(67676),r(80442),r(71715)),d=r(52011),u=r(30556);let p=i=class extends o.wq{static get allTime(){return c}static get empty(){return h}constructor(e){super(e),this.end=null,this.start=null}readEnd(e,t){return null!=t.end?new Date(t.end):null}writeEnd(e,t){t.end=e?.getTime()??null}get isAllTime(){return this.equals(i.allTime)}get isEmpty(){return this.equals(i.empty)}readStart(e,t){return null!=t.start?new Date(t.start):null}writeStart(e,t){t.start=e?.getTime()??null}clone(){return new i({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=this.start?.getTime()??this.start,r=this.end?.getTime()??this.end,i=e.start?.getTime()??e.start,n=e.end?.getTime()??e.end;return t===i&&r===n}expandTo(e,t="system"){if(this.isEmpty||this.isAllTime)return this.clone();let r=this.start;r&&(r=(0,s.JE)(r,e,t));let n=this.end;if(n){const r=(0,s.JE)(n,e,t);n=n.getTime()===r.getTime()?r:(0,s.Nm)(r,1,e,t)}return new i({start:r,end:n})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return i.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=this.start?.getTime()??-1/0,r=this.end?.getTime()??1/0,n=e.start?.getTime()??-1/0,o=e.end?.getTime()??1/0;let s,a;if(n>=t&&n<=r?s=n:t>=n&&t<=o&&(s=t),r>=n&&r<=o?a=r:o>=t&&o<=r&&(a=o),null!=s&&null!=a&&!isNaN(s)&&!isNaN(a)){const e=new i;return e.start=s===-1/0?null:new Date(s),e.end=a===1/0?null:new Date(a),e}return i.empty}offset(e,t,r="system"){if(this.isEmpty||this.isAllTime)return this.clone();const n=new i,{start:o,end:a}=this;return null!=o&&(n.start=(0,s.Nm)(o,e,t,r)),null!=a&&(n.end=(0,s.Nm)(a,e,t,r)),n}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return c.clone();const t=null!=this.start&&null!=e.start?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,r=null!=this.end&&null!=e.end?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new i({start:t,end:r})}};(0,n._)([(0,a.Cb)({type:Date,json:{write:{allowNull:!0}}})],p.prototype,"end",void 0),(0,n._)([(0,l.r)("end")],p.prototype,"readEnd",null),(0,n._)([(0,u.c)("end")],p.prototype,"writeEnd",null),(0,n._)([(0,a.Cb)({readOnly:!0,json:{read:!1}})],p.prototype,"isAllTime",null),(0,n._)([(0,a.Cb)({readOnly:!0,json:{read:!1}})],p.prototype,"isEmpty",null),(0,n._)([(0,a.Cb)({type:Date,json:{write:{allowNull:!0}}})],p.prototype,"start",void 0),(0,n._)([(0,l.r)("start")],p.prototype,"readStart",null),(0,n._)([(0,u.c)("start")],p.prototype,"writeStart",null),p=i=(0,n._)([(0,d.j)("esri.TimeExtent")],p);const c=new p,h=new p({start:void 0,end:void 0}),y=p},65845:(e,t,r)=>{r.d(t,{D:()=>n});var i=r(81153);function n(e){e&&e.writtenProperties&&e.writtenProperties.forEach((({target:e,propName:t,newOrigin:r})=>{(0,i.l)(e)&&r&&e.originOf(t)!==r&&e.updateOrigin(t,r)}))}},81153:(e,t,r)=>{function i(e){return e&&"getAtOrigin"in e&&"originOf"in e}r.d(t,{l:()=>i})},35463:(e,t,r)=>{r.d(t,{JE:()=>a,Nm:()=>s,rJ:()=>l});var i=r(90344),n=r(17126);const o={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8};function s(e,t,r,o="system"){const s=new n.vF((0,i.f1)(o)),a=n.ou.fromJSDate(e,{zone:s}),l="decades"===r||"centuries"===r?"year":d(r);return"decades"===r&&(t*=10),"centuries"===r&&(t*=100),a.plus({[l]:t}).toJSDate()}function a(e,t,r="system"){const o=new n.vF((0,i.f1)(r)),s=n.ou.fromJSDate(e,{zone:o});if("decades"===t||"centuries"===t){const e=s.startOf("year"),{year:r}=e,i=r-r%("decades"===t?10:100);return e.set({year:i}).toJSDate()}const a=d(t);return s.startOf(a).toJSDate()}function l(e,t,r){return 0===e?0:e*o[t]/o[r]}function d(e){switch(e){case"milliseconds":return"millisecond";case"seconds":return"second";case"minutes":return"minute";case"hours":return"hour";case"days":return"day";case"weeks":return"week";case"months":return"month";case"years":return"year"}}},41123:(e,t,r)=>{r.d(t,{D:()=>n,z:()=>o});const i="randomUUID"in crypto;function n(){if(i)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint16Array(8));e[3]=4095&e[3]|16384,e[4]=16383&e[4]|32768;const t=t=>e[t].toString(16).padStart(4,"0");return t(0)+t(1)+"-"+t(2)+"-"+t(3)+"-"+t(4)+"-"+t(5)+t(6)+t(7)}function o(){return`{${n()}}`}},79235:(e,t,r)=>{r.d(t,{Z:()=>w});var i,n=r(43697),o=r(67676),s=r(35454),a=r(96674),l=r(67900),d=r(20941),u=r(5600),p=(r(75215),r(80442),r(71715)),c=r(52011),h=r(30556);const y=(0,s.w)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),m=y.jsonValues.slice();(0,o.e$)(m,"orthometric");const f=(0,s.w)()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let g=i=class extends a.wq{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,r){return y.write(e,t,r)}readHeightModel(e,t,r){return y.read(e)||(r&&r.messages&&r.messages.push(function(e,t){return new d.Z("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:r})),null)}readHeightUnit(e,t,r){return f.read(e)||(r&&r.messages&&r.messages.push(v(e,{context:r})),null)}readHeightUnitService(e,t,r){return(0,l.$C)(e)||f.read(e)||(r&&r.messages&&r.messages.push(v(e,{context:r})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new i({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const r=(0,l.cM)(t);return new i({heightModel:e.heightModel,heightUnit:r,vertCRS:e.vertCRS})}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new i;return t.read(e,{origin:"web-scene"}),t}};function v(e,t){return new d.Z("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,n._)([(0,u.Cb)({type:y.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:m,default:"ellipsoidal"}}}})],g.prototype,"heightModel",void 0),(0,n._)([(0,h.c)("web-scene","heightModel")],g.prototype,"writeHeightModel",null),(0,n._)([(0,p.r)(["web-scene","service"],"heightModel")],g.prototype,"readHeightModel",null),(0,n._)([(0,u.Cb)({type:f.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:f.jsonValues,write:f.write}}}})],g.prototype,"heightUnit",void 0),(0,n._)([(0,p.r)("web-scene","heightUnit")],g.prototype,"readHeightUnit",null),(0,n._)([(0,p.r)("service","heightUnit")],g.prototype,"readHeightUnitService",null),(0,n._)([(0,u.Cb)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],g.prototype,"vertCRS",void 0),(0,n._)([(0,p.r)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],g.prototype,"readVertCRS",null),g=i=(0,n._)([(0,c.j)("esri.geometry.HeightModelInfo")],g);const w=g},90344:(e,t,r)=>{r.d(t,{Xr:()=>y,Ze:()=>v,f1:()=>S,p6:()=>w});var i=r(35454),n=r(70171),o=r(15512);r(17126);const s=Intl.DateTimeFormat().resolvedOptions().timeZone,a=(o.pt,{year:"numeric",month:"numeric",day:"numeric"}),l={year:"numeric",month:"long",day:"numeric"},d={year:"numeric",month:"short",day:"numeric"},u={year:"numeric",month:"long",weekday:"long",day:"numeric"},p={hour:"numeric",minute:"numeric"},c={...p,second:"numeric"},h={"short-date":a,"short-date-short-time":{...a,...p},"short-date-short-time-24":{...a,...p,hour12:!1},"short-date-long-time":{...a,...c},"short-date-long-time-24":{...a,...c,hour12:!1},"short-date-le":a,"short-date-le-short-time":{...a,...p},"short-date-le-short-time-24":{...a,...p,hour12:!1},"short-date-le-long-time":{...a,...c},"short-date-le-long-time-24":{...a,...c,hour12:!1},"long-month-day-year":l,"long-month-day-year-short-time":{...l,...p},"long-month-day-year-short-time-24":{...l,...p,hour12:!1},"long-month-day-year-long-time":{...l,...c},"long-month-day-year-long-time-24":{...l,...c,hour12:!1},"day-short-month-year":d,"day-short-month-year-short-time":{...d,...p},"day-short-month-year-short-time-24":{...d,...p,hour12:!1},"day-short-month-year-long-time":{...d,...c},"day-short-month-year-long-time-24":{...d,...c,hour12:!1},"long-date":u,"long-date-short-time":{...u,...p},"long-date-short-time-24":{...u,...p,hour12:!1},"long-date-long-time":{...u,...c},"long-date-long-time-24":{...u,...c,hour12:!1},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":p,"long-time":c},y=(0,i.w)()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),m={ar:"ar-u-nu-latn-ca-gregory"};let f=new WeakMap;const g=h["short-date-short-time"];function v(e){return h[e]}function w(e,t=g){return function(e){let t=f.get(e);if(!t){const r=(0,n.Kd)(),i=m[r]||r,s=S(e.timeZone??o.By),a={...e,timeZone:s};t=new Intl.DateTimeFormat(i,a),f.set(e,t)}return t}(t).format(e)}function S(e){switch(e){case o.By:return s;case o._4:return o.pt;default:return e}}(0,n.Ze)((()=>{f=new WeakMap}))},10608:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ee});var i=r(43697),n=r(51773),o=r(3172),s=r(20102),a=r(22974),l=r(92604),d=r(16453),u=r(78286),p=r(95330),c=r(17452),h=r(5600),y=r(75215),m=r(71715),f=r(52011),g=r(30556),v=r(87085),w=r(54295),S=r(17287),b=r(38009),_=r(16859),I=r(72965),x=r(20559),C=r(36030),T=r(96674);r(67676),r(80442);let R=class extends T.wq{constructor(e){super(e),this.field=null,this.type=null}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}};(0,i._)([(0,h.Cb)({type:String,json:{write:{enabled:!0,isRequired:!0}}})],R.prototype,"field",void 0),(0,i._)([(0,h.Cb)({readOnly:!0,nonNullable:!0,json:{read:!1}})],R.prototype,"type",void 0),R=(0,i._)([(0,f.j)("esri.layers.pointCloudFilters.PointCloudFilter")],R);const P=R;var Z;let E=Z=class extends P{constructor(e){super(e),this.requiredClearBits=null,this.requiredSetBits=null,this.type="bitfield"}clone(){return new Z({field:this.field,requiredClearBits:(0,a.d9)(this.requiredClearBits),requiredSetBits:(0,a.d9)(this.requiredSetBits)})}};(0,i._)([(0,h.Cb)({type:[y.z8],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredSetBits}}}}})],E.prototype,"requiredClearBits",void 0),(0,i._)([(0,h.Cb)({type:[y.z8],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredClearBits}}}}})],E.prototype,"requiredSetBits",void 0),(0,i._)([(0,C.J)({pointCloudBitfieldFilter:"bitfield"})],E.prototype,"type",void 0),E=Z=(0,i._)([(0,f.j)("esri.layers.pointCloudFilters.PointCloudBitfieldFilter")],E);const F=E;var j;let U=j=class extends P{constructor(e){super(e),this.includedReturns=[],this.type="return"}clone(){return new j({field:this.field,includedReturns:(0,a.d9)(this.includedReturns)})}};(0,i._)([(0,h.Cb)({type:[["firstOfMany","last","lastOfMany","single"]],json:{write:{enabled:!0,isRequired:!0}}})],U.prototype,"includedReturns",void 0),(0,i._)([(0,C.J)({pointCloudReturnFilter:"return"})],U.prototype,"type",void 0),U=j=(0,i._)([(0,f.j)("esri.layers.pointCloudFilters.PointCloudReturnFilter")],U);const N=U;var O;let L=O=class extends P{constructor(e){super(e),this.mode="exclude",this.type="value",this.values=[]}clone(){return new O({field:this.field,mode:this.mode,values:(0,a.d9)(this.values)})}};(0,i._)([(0,h.Cb)({type:["exclude","include"],json:{write:{enabled:!0,isRequired:!0}}})],L.prototype,"mode",void 0),(0,i._)([(0,C.J)({pointCloudValueFilter:"value"})],L.prototype,"type",void 0),(0,i._)([(0,h.Cb)({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],L.prototype,"values",void 0),L=O=(0,i._)([(0,f.j)("esri.layers.pointCloudFilters.PointCloudValueFilter")],L);const D={key:"type",base:P,typeMap:{value:L,bitfield:F,return:N}};var M,A=r(21506),q=r(1231),k=r(53518),K=r(11223),V=r(23030),$=r(25848);let B=M=class extends $.Z{constructor(e){super(e),this.type="point-cloud-rgb",this.field=null}clone(){return new M({...this.cloneProperties(),field:(0,a.d9)(this.field)})}};(0,i._)([(0,C.J)({pointCloudRGBRenderer:"point-cloud-rgb"})],B.prototype,"type",void 0),(0,i._)([(0,h.Cb)({type:String,json:{write:!0}})],B.prototype,"field",void 0),B=M=(0,i._)([(0,f.j)("esri.renderers.PointCloudRGBRenderer")],B);const H=B;var J=r(14008),z=r(46329);const Y={key:"type",base:$.Z,typeMap:{"point-cloud-class-breaks":V.Z,"point-cloud-rgb":H,"point-cloud-stretch":J.Z,"point-cloud-unique-value":z.Z},errorContext:"renderer"};var G=r(36405),W=r(32163);const Q=(0,k.v)();let X=class extends((0,x.Vt)((0,S.Y)((0,b.q)((0,_.I)((0,I.M)((0,d.R)((0,w.V)(v.Z)))))))){constructor(...e){super(...e),this.operationalLayerType="PointCloudLayer",this.popupEnabled=!0,this.popupTemplate=null,this.opacity=1,this.filters=[],this.fields=null,this.fieldsIndex=null,this.outFields=null,this.path=null,this.legendEnabled=!0,this.renderer=null,this.type="point-cloud"}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}get defaultPopupTemplate(){return this.attributeStorageInfo?this.createPopupTemplate():null}getFieldDomain(e){const t=this.fieldsIndex.get(e);return t&&t.domain?t.domain:null}readServiceFields(e,t,r){return Array.isArray(e)?e.map((e=>{const t=new q.Z;return"FieldTypeInteger"===e.type&&((e=(0,a.d9)(e)).type="esriFieldTypeInteger"),t.read(e,r),t})):Array.isArray(t.attributeStorageInfo)?t.attributeStorageInfo.map((e=>new q.Z({name:e.name,type:"ELEVATION"===e.name?"double":"integer"}))):null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}writeRenderer(e,t,r,i){(0,u.RB)("layerDefinition.drawingInfo.renderer",e.write({},i),t)}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p.r9).then((()=>this._fetchService(t)));return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){const t=(0,W.eZ)(this,e);return t&&(this._formatPopupTemplateReturnsField(t),this._formatPopupTemplateRGBField(t)),t}_formatPopupTemplateReturnsField(e){const t=this.fieldsIndex.get("RETURNS");if(!t)return;const r=e.fieldInfos?.find((e=>e.fieldName===t.name));if(!r)return;const i=new K.Z({name:"pcl-returns-decoded",title:t.alias||t.name,expression:`\n var returnValue = $feature.${t.name};\n return (returnValue % 16) + " / " + Floor(returnValue / 16);\n `});e.expressionInfos=[...e.expressionInfos||[],i],r.fieldName="expression/pcl-returns-decoded"}_formatPopupTemplateRGBField(e){const t=this.fieldsIndex.get("RGB");if(!t)return;const r=e.fieldInfos?.find((e=>e.fieldName===t.name));if(!r)return;const i=new K.Z({name:"pcl-rgb-decoded",title:t.alias||t.name,expression:`\n var rgb = $feature.${t.name};\n var red = Floor(rgb / 65536, 0);\n var green = Floor((rgb - (red * 65536)) / 256,0);\n var blue = rgb - (red * 65536) - (green * 256);\n\n return "rgb(" + red + "," + green + "," + blue + ")";\n `});e.expressionInfos=[...e.expressionInfos||[],i],r.fieldName="expression/pcl-rgb-decoded"}async queryCachedStatistics(e,t){if(await this.load(t),!this.attributeStorageInfo)throw new s.Z("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new s.Z("pointcloudlayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const e of this.attributeStorageInfo)if(e.name===r.name){const r=(0,c.v_)(this.parsedUrl.path,`./statistics/${e.key}`);return(0,o.Z)(r,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new s.Z("pointcloudlayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(x.xp.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"};return this._debouncedSaveOperations(x.xp.SAVE,e)}validateLayer(e){if(e.layerType&&"PointCloud"!==e.layerType)throw new s.Z("pointcloudlayer:layer-type-not-supported","PointCloudLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new s.Z("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"});if(this.version.major>2)throw new s.Z("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"})}hasCachedStatistics(e){return null!=this.attributeStorageInfo&&this.attributeStorageInfo.some((t=>t.name===e))}_getTypeKeywords(){return["PointCloud"]}_validateElevationInfo(){const e=this.elevationInfo;(0,G.LR)(l.Z.getLogger(this),(0,G.Uy)("Point cloud layers","absolute-height",e)),(0,G.LR)(l.Z.getLogger(this),(0,G.kf)("Point cloud layers",e))}};(0,i._)([(0,h.Cb)({type:["PointCloudLayer"]})],X.prototype,"operationalLayerType",void 0),(0,i._)([(0,h.Cb)(A.C_)],X.prototype,"popupEnabled",void 0),(0,i._)([(0,h.Cb)({type:n.Z,json:{name:"popupInfo",write:!0}})],X.prototype,"popupTemplate",void 0),(0,i._)([(0,h.Cb)({readOnly:!0,json:{read:!1}})],X.prototype,"defaultPopupTemplate",null),(0,i._)([(0,h.Cb)({readOnly:!0,json:{write:!1,read:!1,origins:{"web-document":{write:!1,read:!1}}}})],X.prototype,"opacity",void 0),(0,i._)([(0,h.Cb)({type:["show","hide"]})],X.prototype,"listMode",void 0),(0,i._)([(0,h.Cb)({types:[D],json:{origins:{service:{read:{source:"filters"}}},name:"layerDefinition.filters",write:!0}})],X.prototype,"filters",void 0),(0,i._)([(0,h.Cb)({type:[q.Z]})],X.prototype,"fields",void 0),(0,i._)([(0,h.Cb)(Q.fieldsIndex)],X.prototype,"fieldsIndex",void 0),(0,i._)([(0,m.r)("service","fields",["fields","attributeStorageInfo"])],X.prototype,"readServiceFields",null),(0,i._)([(0,h.Cb)(Q.outFields)],X.prototype,"outFields",void 0),(0,i._)([(0,h.Cb)({readOnly:!0})],X.prototype,"attributeStorageInfo",void 0),(0,i._)([(0,h.Cb)(A.PV)],X.prototype,"elevationInfo",null),(0,i._)([(0,h.Cb)({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],X.prototype,"path",void 0),(0,i._)([(0,h.Cb)(A.rn)],X.prototype,"legendEnabled",void 0),(0,i._)([(0,h.Cb)({types:Y,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:{target:{"layerDefinition.drawingInfo.renderer":{types:Y},"layerDefinition.drawingInfo.transparency":{type:Number}}}}})],X.prototype,"renderer",void 0),(0,i._)([(0,g.c)("renderer")],X.prototype,"writeRenderer",null),(0,i._)([(0,h.Cb)({json:{read:!1},readOnly:!0})],X.prototype,"type",void 0),X=(0,i._)([(0,f.j)("esri.layers.PointCloudLayer")],X);const ee=X},54295:(e,t,r)=>{r.d(t,{V:()=>s});var i=r(43697),n=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const s=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,i._)([(0,n.Cb)({type:String})],t.prototype,"apiKey",null),t=(0,i._)([(0,o.j)("esri.layers.mixins.APIKeyMixin")],t),t}},17287:(e,t,r)=>{r.d(t,{Y:()=>l});var i=r(43697),n=r(92604),o=r(5600),s=(r(75215),r(67676),r(80442),r(52011)),a=r(66677);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,a.Qc)(this.url);if(null!=e&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,a.Nm)(e,n.Z.getLogger(this)))}};return(0,i._)([(0,o.Cb)()],t.prototype,"title",null),(0,i._)([(0,o.Cb)({type:String})],t.prototype,"url",null),t=(0,i._)([(0,s.j)("esri.layers.mixins.ArcGISService")],t),t}},16859:(e,t,r)=>{r.d(t,{I:()=>_});var i=r(43697),n=r(68773),o=r(40330),s=r(3172),a=r(66643),l=r(20102),d=r(92604),u=r(70586),p=r(95330),c=r(17452),h=r(5600),y=(r(75215),r(67676),r(80442),r(71715)),m=r(52011),f=r(30556),g=r(84230),v=r(48522),w=r(15235),S=r(86082),b=r(14661);const _=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,u.SC)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new w.default({id:t.itemId,portal:r&&r.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const{load:i}=await r.e(8062).then(r.bind(r,18062));return(0,p.k_)(t),await i({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap},t)}catch(e){throw(0,p.D_)(e)||d.Z.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,p.r9)(e),!0))))}async setUserPrivileges(e,t){if(!n.default.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:i},content:{updateItem:n}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",i),this._set("userHasUpdateItemPrivileges",n)}catch(e){(0,p.r9)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const i=e===r.id;if(i&&r.portal.user)return(0,b.Ss)(r);let n,s;if(i)n=r.portal.url;else try{n=await(0,g.oP)(this.url,t)}catch(e){(0,p.r9)(e)}if(!n||!(0,c.Zo)(n,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;s=await(o.id?.getCredential(`${n}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,p.r9)(e)}if(!s)return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}};try{if(i?await r.reload():(r=new w.default({id:e,portal:{url:n}}),await r.load(t)),r.portal.user)return(0,b.Ss)(r)}catch(e){(0,p.r9)(e)}return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}}}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,p.r9)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?o.id?.findCredential(this.url):null;if(!t)return!0;const r=I.credential===t?I.user:await this._fetchEditingUser(e);return I.credential=t,I.user=r,null==r||null==r.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=o.id.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const i=`${r.owningSystemUrl}/sharing/rest`,n=v.Z.getDefault();if(n&&n.loaded&&(0,c.Fv)(n.restUrl)===(0,c.Fv)(i))return n.user;const l=`${i}/community/self`,d=null!=e?e.signal:null,u=await(0,a.q6)((0,s.Z)(l,{authMode:"no-prompt",query:{f:"json"},signal:d}));return u.ok?S.Z.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t&&t.portal,i=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||v.Z.getDefault());return r&&i&&!(0,c.tm)(i.restUrl,r.restUrl)?(t.messages&&t.messages.push(new l.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,i._)([(0,h.Cb)({type:w.default})],t.prototype,"portalItem",null),(0,i._)([(0,y.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,i._)([(0,f.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,i._)([(0,h.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,i._)([(0,h.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,i._)([(0,h.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,i._)([(0,h.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,i._)([(0,m.j)("esri.layers.mixins.PortalLayer")],t),t},I={credential:null,user:null}},72965:(e,t,r)=>{r.d(t,{M:()=>s});var i=r(43697),n=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const s=e=>{let t=class extends e{constructor(){super(...arguments),this.minScale=0,this.maxScale=0}get effectiveScaleRange(){const e={minScale:this.minScale,maxScale:this.maxScale},t=this.parent;t&&"effectiveScaleRange"in t&&function(e,t){e.minScale=e.minScale>0?t.minScale>0?Math.min(e.minScale,t.minScale):e.minScale:t.minScale,e.maxScale=e.maxScale>0?t.maxScale>0?Math.max(e.maxScale,t.maxScale):e.maxScale:t.maxScale}(e,t.effectiveScaleRange);const r=this._get("effectiveScaleRange");return r&&r.minScale===e.minScale&&r.maxScale===e.maxScale?r:e}};return(0,i._)([(0,n.Cb)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"minScale",void 0),(0,i._)([(0,n.Cb)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"maxScale",void 0),(0,i._)([(0,n.Cb)({readOnly:!0})],t.prototype,"effectiveScaleRange",null),t=(0,i._)([(0,o.j)("esri.layers.mixins.ScaleRangeLayer")],t),t}},20559:(e,t,r)=>{r.d(t,{xp:()=>A,Vt:()=>U});var i=r(43697),n=r(3172),o=r(20102),s=r(92604),a=r(95330),l=r(17452),d=r(5600),u=(r(75215),r(67676),r(80442),r(71715)),p=r(52011),c=r(30556),h=r(65845),y=r(6570),m=r(79235),f=r(82971),g=r(66677),v=r(21506),w=r(61064);var S=r(48522),b=r(15235),_=r(66643),I=r(41123),x=r(97873);async function C(e,t,r=null){const i=await R(e,t,r);await P(i,t,r)}async function T(e,t,r,i,n=null){const o=await R(r,i,n);await e.update({data:t}),await P(o,i,n)}async function R(e,t,r=null){if(!t||!t.resources)return;const i=t.portalItem===e.portalItem?new Set(e.paths):new Set;e.paths.length=0,e.portalItem=t.portalItem;const n=new Set(t.resources.toKeep.map((e=>e.resource.path))),s=new Set,l=[];n.forEach((t=>{i.delete(t),e.paths.push(t)}));for(const o of t.resources.toUpdate)if(i.delete(o.resource.path),n.has(o.resource.path)||s.has(o.resource.path)){const{resource:t,content:i,finish:n,error:s}=o,a=(0,x.W7)(t,(0,I.D)());e.paths.push(a.path),l.push(Z({resource:a,content:i,compress:o.compress,finish:n,error:s},r))}else e.paths.push(o.resource.path),l.push(E(o,r)),s.add(o.resource.path);for(const n of t.resources.toAdd)e.paths.push(n.resource.path),i.has(n.resource.path)?i.delete(n.resource.path):l.push(Z(n,r));if(0===l.length)return i;const d=await(0,a.UO)(l);if((0,a.k_)(r),d.length>0)throw new o.Z("save:resources","Failed to save one or more resources",{errors:d});return i}async function P(e,t,r=null){if(!e||!t.portalItem)return;const i=[];for(const n of e){const e=t.portalItem.resourceFromPath(n);i.push(e.portalItem.removeResource(e,r))}await(0,a.as)(i)}async function Z(e,t){const r={...null!=t?t:{},compress:e.compress},i=await(0,_.q6)(e.resource.portalItem.addResource(e.resource,await(0,x.FO)(e.content),r));if(!0!==i.ok)throw e.error?.(i.error),i.error;e.finish?.(e.resource)}async function E(e,t){const r=await(0,_.q6)(e.resource.update(await(0,x.FO)(e.content),t));if(!0!==r.ok)throw e.error?.(r.error),r.error;e.finish?.(e.resource)}const F="esri.layers.mixins.SceneService",j=s.Z.getLogger(F),U=e=>{let t=class extends e{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.indexInfo=null,this._debouncedSaveOperations=(0,a.Ds)((async(e,t,r)=>{switch(e){case A.SAVE:return this._save(t);case A.SAVE_AS:return this._saveAs(r,t)}}))}readSpatialReference(e,t){return this._readSpatialReference(t)}_readSpatialReference(e){if(null!=e.spatialReference)return f.Z.fromJSON(e.spatialReference);{const t=e.store,r=t.indexCRS||t.geographicCRS,i=r&&parseInt(r.substring(r.lastIndexOf("/")+1,r.length),10);return null!=i?new f.Z(i):null}}readFullExtent(e,t,r){if(null!=e&&"object"==typeof e){const i=null==e.spatialReference?{...e,spatialReference:this._readSpatialReference(t)}:e;return y.Z.fromJSON(i,r)}const i=t.store,n=this._readSpatialReference(t);return null==n||null==i||null==i.extent||!Array.isArray(i.extent)||i.extent.some((e=>e<N))?null:new y.Z({xmin:i.extent[0],ymin:i.extent[1],xmax:i.extent[2],ymax:i.extent[3],spatialReference:n})}parseVersionString(e){const t={major:Number.NaN,minor:Number.NaN,versionString:e},r=e.split(".");return r.length>=2&&(t.major=parseInt(r[0],10),t.minor=parseInt(r[1],10)),t}readVersion(e,t){const r=t.store,i=null!=r.version?r.version.toString():"";return this.parseVersionString(i)}readTitlePortalItem(e){return"item-title"!==this.sublayerTitleMode?void 0:e}readTitleService(e,t){const r=this.portalItem&&this.portalItem.title;if("item-title"===this.sublayerTitleMode)return(0,g.a7)(this.url,t.name);let i=t.name;if(!i&&this.url){const e=(0,g.Qc)(this.url);null!=e&&(i=e.title)}return"item-title-and-service-name"===this.sublayerTitleMode&&r&&(i=r+" - "+i),(0,g.ld)(i)}set url(e){const t=(0,g.XG)({layer:this,url:e,nonStandardUrlAllowed:!1,logger:j});this._set("url",t.url),null!=t.layerId&&this._set("layerId",t.layerId)}writeUrl(e,t,r,i){(0,g.wH)(this,e,"layers",t,i)}get parsedUrl(){const e=this._get("url"),t=(0,l.mN)(e);return null!=this.layerId&&(t.path=`${t.path}/layers/${this.layerId}`),t}async _fetchIndexAndUpdateExtent(e,t){this.indexInfo=(0,w.T)(this.parsedUrl.path,this.rootNode,e,this.apiKey,j,t),null==this.fullExtent||this.fullExtent.hasZ||this._updateExtent(await this.indexInfo)}_updateExtent(e){if("page"===e?.type){const t=e.rootIndex%e.pageSize,r=e.rootPage?.nodes?.[t];if(null==r||null==r.obb||null==r.obb.center||null==r.obb.halfSize)throw new o.Z("sceneservice:invalid-node-page","Invalid node page.");if(r.obb.center[0]<N||null==this.fullExtent||this.fullExtent.hasZ)return;const i=r.obb.halfSize,n=r.obb.center[2],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);this.fullExtent.zmin=n-s,this.fullExtent.zmax=n+s}else if("node"===e?.type){const t=e.rootNode?.mbs;if(!Array.isArray(t)||4!==t.length||t[0]<N)return;const r=t[2],i=t[3],{fullExtent:n}=this;n&&(n.zmin=r-i,n.zmax=r+i)}}async _fetchService(e){if(null==this.url)throw new o.Z("sceneservice:url-not-set","Scene service can not be loaded without valid portal item or url");if(null==this.layerId&&/SceneServer\/*$/i.test(this.url)){const t=await this._fetchFirstLayerId(e);null!=t&&(this.layerId=t)}return this._fetchServiceLayer(e)}async _fetchFirstLayerId(e){const t=await(0,n.Z)(this.url,{query:{f:"json",token:this.apiKey},responseType:"json",signal:e});if(t.data&&Array.isArray(t.data.layers)&&t.data.layers.length>0)return t.data.layers[0].id}async _fetchServiceLayer(e){const t=await(0,n.Z)(this.parsedUrl?.path??"",{query:{f:"json",token:this.apiKey},responseType:"json",signal:e});t.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let r=!1;if(t.data.layerType&&"Voxel"===t.data.layerType&&(r=!0),r)return this._fetchVoxelServiceLayer();const i=t.data;this.read(i,this._getServiceContext()),this.validateLayer(i)}async _fetchVoxelServiceLayer(e){const t=(await(0,n.Z)(this.parsedUrl?.path+"/layer",{query:{f:"json",token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,this._getServiceContext()),this.validateLayer(t)}_getServiceContext(){return{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&"function"==typeof this.beforeSave&&await this.beforeSave()}validateLayer(e){}_updateTypeKeywords(e,t,r){e.typeKeywords||(e.typeKeywords=[]);const i=t.getTypeKeywords();for(const t of i)e.typeKeywords.push(t);e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)),r===O.newItem&&(e.typeKeywords=e.typeKeywords.filter((e=>"Hosted Service"!==e))))}async _saveAs(e,t){const r={...M,...t};let i=b.default.from(e);i||(j.error("_saveAs(): requires a portal item parameter"),await Promise.reject(new o.Z("sceneservice:portal-item-required","_saveAs() requires a portal item to save to"))),i.id&&(i=i.clone(),i.id=null);const n=i.portal||S.Z.getDefault();await this._ensureLoadBeforeSave(),i.type=D,i.portal=n;const s={origin:"portal-item",url:null,messages:[],portal:n,portalItem:i,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},a={layers:[this.write({},s)]};return await Promise.all(s.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(a,s,r),i.url=this.url,i.title||(i.title=this.title),this._updateTypeKeywords(i,r,O.newItem),await n.signIn(),await(n.user?.addItem({item:i,folder:r&&r.folder,data:a})),await C(this.resourceReferences,s,null),this.portalItem=i,(0,h.D)(s),s.portalItem=i,i}async _save(e){const t={...M,...e};if(!this.portalItem)throw j.error("_save(): requires the .portalItem property to be set"),new o.Z("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(this.portalItem.type!==D)throw j.error("_save(): Non-matching portal item type. Got "+this.portalItem.type+", expected "+D),new o.Z("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${D}"`);await this._ensureLoadBeforeSave();const r={origin:"portal-item",url:this.portalItem.itemUrl&&(0,l.mN)(this.portalItem.itemUrl),messages:[],portal:this.portalItem.portal||S.Z.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},i={layers:[this.write({},r)]};return await Promise.all(r.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(i,r,t),this.portalItem.url=this.url,this.portalItem.title||(this.portalItem.title=this.title),this._updateTypeKeywords(this.portalItem,t,O.existingItem),await T(this.portalItem,i,this.resourceReferences,r,null),(0,h.D)(r),this.portalItem}async _validateAgainstJSONSchema(e,t,r){let i=t.messages?.filter((e=>"error"===e.type)).map((e=>new o.Z(e.name,e.message,e.details)))??[];r?.validationOptions?.ignoreUnsupported&&(i=i.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name&&"scenemodification:unsupported"!==e.name)));const n=r?.validationOptions,s=n?.enabled,a=null;if(s&&a){const t=(await a()).validate(e,r.portalItemLayerType);if(t.length>0){const e=`Layer item did not validate:\n${t.join("\n")}`;if(j.error(`_validateAgainstJSONSchema(): ${e}`),"throw"===n.failPolicy){const e=t.map((e=>new o.Z("sceneservice:schema-validation",e))).concat(i);throw new o.Z("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{combined:e})}}}if(i.length>0)throw new o.Z("sceneservice:save","Failed to save SceneService due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:i})}};return(0,i._)([(0,d.Cb)(v.id)],t.prototype,"id",void 0),(0,i._)([(0,d.Cb)({type:f.Z})],t.prototype,"spatialReference",void 0),(0,i._)([(0,u.r)("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],t.prototype,"readSpatialReference",null),(0,i._)([(0,d.Cb)({type:y.Z})],t.prototype,"fullExtent",void 0),(0,i._)([(0,u.r)("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],t.prototype,"readFullExtent",null),(0,i._)([(0,d.Cb)({readOnly:!0,type:m.Z})],t.prototype,"heightModelInfo",void 0),(0,i._)([(0,d.Cb)({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],t.prototype,"minScale",void 0),(0,i._)([(0,d.Cb)({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],t.prototype,"maxScale",void 0),(0,i._)([(0,d.Cb)({readOnly:!0})],t.prototype,"version",void 0),(0,i._)([(0,u.r)("version",["store.version"])],t.prototype,"readVersion",null),(0,i._)([(0,d.Cb)({type:String,json:{read:{source:"copyrightText"}}})],t.prototype,"copyright",void 0),(0,i._)([(0,d.Cb)({type:String,json:{read:!1}})],t.prototype,"sublayerTitleMode",void 0),(0,i._)([(0,d.Cb)({type:String})],t.prototype,"title",void 0),(0,i._)([(0,u.r)("portal-item","title")],t.prototype,"readTitlePortalItem",null),(0,i._)([(0,u.r)("service","title",["name"])],t.prototype,"readTitleService",null),(0,i._)([(0,d.Cb)({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],t.prototype,"layerId",void 0),(0,i._)([(0,d.Cb)(v.HQ)],t.prototype,"url",null),(0,i._)([(0,c.c)("url")],t.prototype,"writeUrl",null),(0,i._)([(0,d.Cb)()],t.prototype,"parsedUrl",null),(0,i._)([(0,d.Cb)({readOnly:!0})],t.prototype,"store",void 0),(0,i._)([(0,d.Cb)({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],t.prototype,"rootNode",void 0),t=(0,i._)([(0,p.j)(F)],t),t},N=-1e38;var O,L;(L=O||(O={}))[L.existingItem=0]="existingItem",L[L.newItem=1]="newItem";const D="Scene Service",M={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}};var A;!function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(A||(A={}))},61064:(e,t,r)=>{r.d(t,{T:()=>o});var i=r(3172),n=r(20102);async function o(e,t,r,o,s,a){let l=null;if(null!=r){const t=`${e}/nodepages/`,n=t+Math.floor(r.rootIndex/r.nodesPerPage);try{return{type:"page",rootPage:(await(0,i.Z)(n,{query:{f:"json",token:o},responseType:"json",signal:a})).data,rootIndex:r.rootIndex,pageSize:r.nodesPerPage,lodMetric:r.lodSelectionMetricType,urlPrefix:t}}catch(e){null!=s&&s.warn("#fetchIndexInfo()","Failed to load root node page. Falling back to node documents.",n,e),l=e}}if(!t)return null;const d=`${e}/nodes/`,u=d+(t&&t.split("/").pop());try{return{type:"node",rootNode:(await(0,i.Z)(u,{query:{f:"json",token:o},responseType:"json",signal:a})).data,urlPrefix:d}}catch(e){throw new n.Z("sceneservice:root-node-missing","Root node missing.",{pageError:l,nodeError:e,url:u})}}},53518:(e,t,r)=>{r.d(t,{v:()=>a});var i=r(92604),n=r(1231),o=r(99514),s=r(35671);function a(){return{fields:{type:[n.Z],value:null},fieldsIndex:{readOnly:!0,get(){return new o.Z(this.fields||[])}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const e=this._userOutFields;if(!e||!e.length)return null;if(e.includes("*"))return["*"];if(!this.fields)return e;for(const t of e){const r=this.fieldsIndex?.has(t);r||i.Z.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e})}return(0,s.Q0)(this.fieldsIndex,e)}}}}},97873:(e,t,r)=>{r.d(t,{FO:()=>p,W7:()=>c,addOrUpdateResource:()=>a,fetchResources:()=>s,removeAllResources:()=>d,removeResource:()=>l});var i=r(3172),n=r(20102),o=r(17452);async function s(e,t={},r){await e.load(r);const i=(0,o.v_)(e.itemUrl,"resources"),{start:n=1,num:s=10,sortOrder:a="asc",sortField:l="created"}=t,d={query:{start:n,num:s,sortOrder:a,sortField:l,token:e.apiKey},signal:r?.signal},u=await e.portal.request(i,d);return{total:u.total,nextStart:u.nextStart,resources:u.resources.map((({created:t,size:r,resource:i})=>({created:new Date(t),size:r,resource:e.resourceFromPath(i)})))}}async function a(e,t,r,i){if(!e.hasPath())throw new n.Z(`portal-item-resource-${t}:invalid-path`,"Resource does not have a valid path");const s=e.portalItem;await s.load(i);const a=(0,o.v_)(s.userItemUrl,"add"===t?"addResources":"updateResources"),[l,d]=u(e.path),p=new FormData;return l&&"."!==l&&p.append("resourcesPrefix",l),null!=i&&i.compress&&p.append("compress","true"),p.append("fileName",d),p.append("file",r,d),p.append("f","json"),null!=i&&i.access&&p.append("access",i.access),await s.portal.request(a,{method:"post",body:p,signal:i?.signal}),e}async function l(e,t,r){if(!t.hasPath())throw new n.Z("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await e.load(r);const i=(0,o.v_)(e.userItemUrl,"removeResources");await e.portal.request(i,{method:"post",query:{resource:t.path},signal:r?.signal}),t.portalItem=null}async function d(e,t){await e.load(t);const r=(0,o.v_)(e.userItemUrl,"removeResources");return e.portal.request(r,{method:"post",query:{deleteAll:!0},signal:t?.signal})}function u(e){const t=e.lastIndexOf("/");return-1===t?[".",e]:[e.slice(0,t),e.slice(t+1)]}async function p(e){return"blob"===e.type?e.blob:"json"===e.type?new Blob([e.jsonString],{type:"application/json"}):(await(0,i.Z)(e.url,{responseType:"blob"})).data}function c(e,t){if(!e.hasPath())return null;const[r,,i]=function(e){const[t,r]=function(e){const t=(0,o.Ml)(e);return null==t?[e,""]:[e.slice(0,e.length-t.length-1),`.${t}`]}(e),[i,n]=u(t);return[i,n,r]}(e.path);return e.portalItem.resourceFromPath((0,o.v_)(r,t+i))}},36405:(e,t,r)=>{function i(e,t){return null!=t&&t.mode?t.mode:function(e){return e?d:u}(e).mode}function n(e,t){return i(null!=e&&e.hasZ,t)}function o(e,t,r){return r&&r.mode!==t?`${e} only support ${t} elevation mode`:null}function s(e,t,r){return r?.mode===t?`${e} do not support ${t} elevation mode`:null}function a(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function l(e,t){t&&e.warn(".elevationInfo=",t)}r.d(t,{LR:()=>l,Uy:()=>o,VW:()=>n,Wb:()=>s,kf:()=>a}),r(12541);const d={mode:"absolute-height",offset:0},u={mode:"on-the-ground",offset:null}},32163:(e,t,r)=>{r.d(t,{eZ:()=>d});var i=r(51773),n=r(35671),o=r(84649),s=(r(63801),r(48074),r(38745),r(9190)),a=(r(10214),r(71423),r(44951),r(422)),l=r(29986);function d({displayField:e,editFieldsInfo:t,fields:r,objectIdField:l,title:d},h){if(!r)return null;const m=function(e,t){const r=t?.visibleFieldNames;return function(e,t){const r=e;return t&&(e=e.filter((e=>!t.includes(e.type)))),e===r&&(e=e.slice()),e.sort(p),e}(e.fields??[],t?.ignoreFieldTypes||y).map((t=>new a.Z({fieldName:t.name,isEditable:(0,n.Hp)(t,e),label:t.alias,format:c(t),visible:u(t,{...e,visibleFieldNames:r})})))}({editFieldsInfo:t,fields:r,objectIdField:l},h);if(!m.length)return null;const f=function(e){const t=(0,n.O5)(e),{titleBase:r}=e;return t?`${r}: {${t.trim()}}`:r??""}({titleBase:d,fields:r,displayField:e}),g=[new s.Z,new o.Z];return new i.Z({title:f,content:g,fieldInfos:m})}const u=(e,t)=>t.visibleFieldNames?t.visibleFieldNames.has(e.name):(0,n.Fv)(e,t);function p(e,t){return"oid"===e.type?-1:"oid"===t.type?1:h(e)?-1:h(t)?1:(e.alias||e.name).toLocaleLowerCase().localeCompare((t.alias||t.name).toLocaleLowerCase())}function c(e){switch(e.type){case"small-integer":case"integer":case"single":return new l.Z({digitSeparator:!0,places:0});case"double":return new l.Z({digitSeparator:!0,places:2});case"string":return(0,n.Ec)(e.name)?new l.Z({digitSeparator:!0,places:0}):null;default:return null}}function h(e){return"name"===(e.name&&e.name.toLowerCase())||"name"===(e.alias&&e.alias.toLowerCase())}const y=["geometry","blob","raster","guid","xml"]},15512:(e,t,r)=>{r.d(t,{By:()=>i,_4:()=>n,pt:()=>o});const i="system",n="unknown",o="UTC"}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5913],{91303:(e,t,i)=>{var n;i.d(t,{Y:()=>n}),function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(n||(n={}))},16306:(e,t,i)=>{i.d(t,{aX:()=>I});var n=i(68773),s=i(20102),r=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),p=i(11282),d=i(17452);async function m(e,t,i){const n="string"==typeof e?(0,d.mN)(e):e,s=t[0].spatialReference,r=(0,f.Ji)(t[0]),a={...i,query:{...n.query,f:"json",sr:(0,c.B9)(s),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.Z)(n.path+"/simplify",a);var l;return function(e,t,i){const n=(0,f.q9)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,r,s)}const y=r.Z.getLogger("esri.geometry.support.normalizeUtils");function g(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(e),new s.Z(e)}const i=(0,l.x3)(e),n=[];for(const e of i){const i=[];n.push(i),i.push([e[0][0],e[0][1]]);for(let n=0;n<e.length-1;n++){const s=e[n][0],r=e[n][1],a=e[n+1][0],o=e[n+1][1],l=Math.sqrt((a-s)*(a-s)+(o-r)*(o-r)),c=(o-r)/l,u=(a-s)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const n=e*t,a=u*n+s,o=c*n+r;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,n=u*e+s,a=c*e+r;i.push([n,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:n,spatialReference:e.spatialReference}):new o.Z({paths:n,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function b(e,t,i){if(Array.isArray(e)){const n=e[0];if(n>t){const i=(0,l.XZ)(n,t);e[0]=n+i*(-2*t)}else if(n<i){const t=(0,l.XZ)(n,i);e[0]=n+t*(-2*i)}}else{const n=e.x;if(n>t){const i=(0,l.XZ)(n,t);e=e.clone().offset(i*(-2*t),0)}else if(n<i){const t=(0,l.XZ)(n,i);e=e.clone().offset(t*(-2*i),0)}}return e}function v(e,t){let i=-1;for(let n=0;n<t.cutIndexes.length;n++){const s=t.cutIndexes[n],r=t.geometries[n],a=(0,l.x3)(r);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const n=t[e][0];i=n>i?n:i}i=Number(i.toFixed(9));const n=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=r.getPoint(e,i);r.setPoint(e,i,t.clone().offset(n,0))}return!0}}))}if(s===i){if(g(e))for(const t of(0,l.x3)(r))e[s]=e[s].addRing(t);else if(x(e))for(const t of(0,l.x3)(r))e[s]=e[s].addPath(t)}else i=s,e[s]=r}return e}async function I(e,t,i){if(!Array.isArray(e))return I([e],t);t&&"string"!=typeof t&&y.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const s="string"==typeof t?t:t?.url??n.default.geometryServiceUrl;let r,d,g,x,_,S,R,T,C=0;const k=[],M=[];for(const t of e)if(null!=t)if(r||(r=t.spatialReference,d=(0,c.C5)(r),g=r.isWebMercator,S=g?102100:4326,x=l.UZ[S].maxX,_=l.UZ[S].minX,R=l.UZ[S].plus180Line,T=l.UZ[S].minus180Line),d)if("mesh"===t.type)M.push(t);else if("point"===t.type)M.push(b(t.clone(),x,_));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>b(e,x,_))),M.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,d);M.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,_)*(2*x);let n=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(R)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,n=w(n,g),k.push(n),M.push("cut")):e.intersects(T)&&e.xmin!==_?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,n=w(n,g,360),k.push(n),M.push("cut")):M.push(n)}else M.push(t.clone());else M.push(t);else M.push(t);let F=(0,l.XZ)(C,x),O=-90;const P=F,Z=new o.Z;for(;F>0;){const e=360*F-180;Z.addPath([[e,O],[e,-1*O]]),O*=-1,F--}if(k.length>0&&P>0){const t=v(k,await async function(e,t,i,n){const s=(0,p.en)(e),r=t[0].spatialReference,a={...n,query:{...s.query,f:"json",sr:(0,c.B9)(r),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.Z)(s.path+"/cut",a),{cutIndexes:l,geometries:u=[]}=o.data;return{cutIndexes:l,geometries:u.map((e=>{const t=(0,f.im)(e);return t.spatialReference=r,t}))}}(s,k,Z,i)),n=[],r=[];for(let i=0;i<M.length;i++){const s=M[i];if("cut"!==s)r.push(s);else{const s=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&s.rings.length>=a.rings.length?(n.push(s),r.push("simplify")):r.push(g?(0,u.$)(s):s)}}if(!n.length)return r;const a=await m(s,n,i),o=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?o.push(t):o.push(g?(0,u.$)(a.shift()):a.shift())}return o}const D=[];for(let e=0;e<M.length;e++){const t=M[e];if("cut"!==t)D.push(t);else{const e=k.shift();D.push(!0===g?(0,u.$)(e):e)}}return D}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var n=i(58901),s=i(82971),r=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new n.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:s.Z.WebMercator}),minus180Line:new n.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:s.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new n.Z({paths:[[[180,-180],[180,180]]],spatialReference:s.Z.WGS84}),minus180Line:new n.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:s.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,r.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ft});var n=i(43697),s=i(51773),r=i(2368),a=i(20102),o=i(92604),l=i(16453),c=i(95330),u=i(17445),h=i(5600),f=i(75215),p=i(67676),d=i(80442),m=i(36030),y=i(52011),g=i(87085),x=i(17287),w=i(71612),b=i(17017),v=(i(66577),i(30030)),I=i(3172),_=i(71715),S=i(8744),R=i(66677),T=i(21506),C=i(35956),k=i(29876),M=i(45663),F=i(88281),O=i(11145),P=i(96674),Z=i(609),D=i(39450),z=i(36679),A=i(99815),N=i(73506),B=i(94139);const E=new Map,J=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.refCount--,e.refCount<=0&&(n.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.ts=Date.now(),e.refCount++,n.delete(i),n.set(i,e),e.block}return null}putBlock(e,t,i,n){const s=this._cachedBlocks,r=e+"/"+t;if(s.has(r)){const e=s.get(r);e.ts=Date.now(),e.refCount++}else s.set(r,{block:i,ts:Date.now(),refCount:1,controller:n});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,n=e+"/"+t;i.has(n)&&i.delete(n)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let n=0;n<t.length&&t[n][1].ts<=i-this._duration;n++)e.delete(t[n][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function L(e,t){return null==t?e:`${e}?sliceId=${t}`}function H(e,t,i){const n=E.get(e);if(!n)return null==t?J.decreaseRefCount(e,i):0;if(null==t||null==n[t])return J.decreaseRefCount(e,i);const s=n[t]?.cache,r=s?.get(i);if(s&&r){if(r.refCount--,0===r.refCount){s.delete(i);for(let e=0;e<n.length;e++)n[e]?.cache.delete(i);r.controller&&r.controller.abort()}return r.refCount}return 0}function W(e,t,i){const n=E.get(e);if(!n)return null==t?J.getBlock(e,i):null;if(null==t||null==n[t]){for(let e=0;e<n.length;e++){const t=n[e]?.cache.get(i);if(t)return t.refCount++,t.block}return J.getBlock(e,i)}const s=n[t]?.cache.get(i);if(s)return s.refCount++,s.block;for(let e=0;e<n.length;e++){if(e===t||!n[e])continue;const s=n[e]?.cache,r=s?.get(i);if(s&&r)return r.refCount++,s.set(i,r),r.block}return null}function q(e,t,i,n,s=null){const r=E.get(e);if(!r)return void(null==t&&J.putBlock(e,i,n,s));if(null==t||null==r[t])return void J.putBlock(e,i,n,s);const a={refCount:1,block:n,isResolved:!1,isRejected:!1,controller:s};n.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),r[t]?.cache.set(i,a)}function j(e,t,i){const n=E.get(e);n?null!=t&&null!=n[t]?n[t]?.cache.delete(i):J.deleteBlock(e,i):null==t&&J.deleteBlock(e,i)}var G=i(81578),U=i(75993),$=i(55914),V=i(80676),X=i(6570);let Y=class extends((0,Z.v)(P.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,N.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:O.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,N.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,R.Nm)(e,o.Z.getLogger(this)))}async open(e){throw new a.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){const s=n.tileInfo||this.rasterInfo.storageInfo.tileInfo,r=this.getTileExtentFromTileInfo(e,t,i,s);return this.fetchPixels(r,s.size[0],s.size[1],n)}async identify(e,t={}){e=(0,f.TJ)(B.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:n}=t,{rasterInfo:s}=this,{hasMultidimensionalTranspose:r,multidimensionalInfo:a}=s;let{transposedVariableName:o}=t;const l=null!=a&&r&&(null!=n||(0,A.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=s,{datumTransformation:h}=t;let p=(0,N.nF)(e,c,h);if(!u.intersects(p))return{location:p,value:null};if(null!=s.transform){const e=s.transform.inverseTransform(p);if(!s.nativeExtent.intersects(e))return{location:e,value:null};p=e}let d=0;const m=null!=o&&null!=a&&s.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(p,t);const{pixelSize:i}=s,n=3,r=i.x*n/2,a=i.y*n/2,o=new X.Z({xmin:p.x-r,xmax:p.x+r,ymin:p.y-a,ymax:p.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,n,n,l),{pixelBlock:h}=await this.fetchPixels(o,n,n,l);if(null==u)return{location:p,value:null};const f=Math.floor(n*n*.5),d=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let y;return null!=h&&(y=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:p,value:d,processedValue:y,pyramidLevel:0}}if(!m)if(t.srcResolution)d=(0,N.kr)(t.srcResolution,s,this.ioConfig.sampling).pyramidLevel;else if(d=await this.computeBestPyramidLevelForLocation(e,t),null==d)return{location:p,value:null};const y=this.identifyPixelLocation(p,d,null,m);if(null===y)return{location:p,value:null};const{row:g,col:x,rowOffset:w,colOffset:b,blockWidth:v}=y,I=o??t.sliceId,_=L(this.url,I),S=`${d}/${g}/${x}`;let R=W(_,null,S);null==R&&(R=this.fetchRawTile(d,g,x,t),q(_,null,S,R));const T=await R;if(null==T||!T.pixels?.length)return{location:p,value:null};const C=w*v+b;return this._processIdentifyResult(T,{srcLocation:p,position:C,pyramidLevel:d,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,n={}){e=(0,N.Fi)(e),n=this._getRequestOptionsWithSliceId(n);const{_hasNoneOrGCSShiftTransform:s}=this;if(n.requestRawData&&s)return this._fetchPixels(e,t,i,n);const r=(0,N.ut)(e.spatialReference),a=(0,N.Hq)(e);if(null==r||0===a||1===a&&this._isGlobalWrappableSource&&s)return this._fetchPixels(e,t,i,n);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(r/(c-l)*t),h=u-Math.round((r/2-l)/(c-l)*t);let f=0;const p=[];for(let s=0;s<=a;s++){const d=new X.Z({xmin:0===s?l:-r/2,xmax:s===a?c-r*s:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===s?u-h:s===a?t-f:u;f+=m,p.push(m);const y=n.disableWrapAround&&s>0?null:this._fetchPixels(d,m,i,n);o.push(y)}const d=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const y={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},n)).pixelBlock:(0,$.us)(d,y,{blockWidths:p}),{extent:e,srcExtent:(0,N.tB)(e,this.rasterInfo.spatialReference,n.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,n={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const s=await this._fetchRawTiles(e,t,i,n),{nativeExtent:r,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new X.Z({xmin:r.xmin+c*t.x,xmax:r.xmin+c*(t.x+i.width-1),ymin:r.ymax-u*(t.y+i.height-1),ymax:r.ymax-u*t.y,spatialReference:r.spatialReference});if(!s)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:p}=s;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:s.pixelBlocks[0]};const d=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,y={x:t.x%d,y:t.y%m};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:n.interpolation,alignmentInfo:null,blockWidths:null},n)).pixelBlock:(0,$.us)(f,p,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,n){throw new a.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,N.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,U.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:n}=this.ioConfig,{range:s,query:r,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=s?{Range:`bytes=${s.from}-${s.to}`}:null;try{return await(0,I.Z)(e,{...t,query:{...r,...n},headers:{...a,...o}})}catch(n){if(i>0)return i--,this.request(e,t,i);throw n}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,A.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,n){const s=n.lodAt(e);return this.getTileExtent({x:s.resolution,y:s.resolution},t,i,n.origin,n.spatialReference,n.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const s=[],r=e.maximumPyramidLevel||0;let a=Math.max(n.x,n.y),o=1/.0254*96*a;for(let e=0;e<=r;e++)s.unshift(new D.Z({level:r-e,resolution:a,scale:o})),a*=2,o*=2;const l=new B.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new O.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:s}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,n){const{width:s,height:r,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new B.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(s,r))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],n);e.storageInfo=new z.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,n,s,r=0,a=2){if(1===s.length&&r>0){s=[...s];let{x:e,y:t}=s[0];for(let i=0;i<r;i++)e*=a,t*=a,s.push({x:e,y:t})}const o=[],{x:l,y:c}=n;for(let n=0;n<s.length;n++){const{x:r,y:a}=s[n];o.push({minCol:Math.floor((e.xmin-l+.1*r)/t/r),maxCol:Math.floor((e.xmax-l-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:n}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const s=n**e;return{x:t.x*s,y:t.y*s}}identifyPixelLocation(e,t,i,n){const{spatialReference:s,nativeExtent:r,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=n&&null!=c?c.tileSize[0]:a.blockWidth,h=n&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,N.nF)(e,s,i);if(!r.intersects(f))return null;if(t<0||t>o)return null;const p=this.getPyramidPixelSize(t),{x:d,y:m}=p,y=(l.y-f.y)/m/h,g=(f.x-l.x)/d/u,x=Math.min(h-1,Math.floor((y-Math.floor(y))*h)),w=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(y),col:Math.floor(g),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,n,s,r){const[a,o]=r,l=n.x+i*a*e.x,c=l+a*e.x,u=n.y-t*o*e.y,h=u-o*e.y;return new X.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:s})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const n=this.rasterInfo.storageInfo.blockBoundary[e];return!n||n.maxRow<t||n.maxCol<i||n.minRow>t||n.minCol>i}async _fetchPixels(e,t,i,n={}){let s=(0,N.Hq)(e);if(s>=2)return{extent:e,pixelBlock:null};const r=this._getSourceDataInfo(e,t,i,n),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=r;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,p=f.transform,d="gcs-shift"===p?.type,m=null!=(0,N.ut)(e.spatialReference);!d&&m||(s=(0,N.Hq)(r.srcExtent,d));const y=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:s},n);if(!y)return{extent:e,srcExtent:l,pixelBlock:null};const g=f.storageInfo,x=a>0?g.pyramidBlockWidth:g.blockWidth,w=a>0?g.pyramidBlockHeight:g.blockHeight;let{x:b,y:v}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[a-1])({x:b,y:v}=e[a-1]);else{const e=t**a;b*=e,v*=e}}const I=f.spatialReference,_=new B.Z({x:b,y:v,spatialReference:I}),S=x===c&&w===u&&h.x%x==0&&h.y%w==0,R=new B.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(I),C=I.isGeographic?1e-9:1e-4,{datumTransformation:k}=n;if(!T&&S&&1===y.pixelBlocks.length&&x===t&&w===i&&this._isSameResolution(o,R,C))return{extent:e,srcExtent:l,srcTilePixelSize:_,pixelBlock:y.pixelBlocks[0]};const M=m&&null!=(0,N.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,F=n.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");F&&!this.rasterJobHandler&&await(0,N.zD)();const O=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R.toJSON(),datumTransformation:k,rasterTransform:p,hasWrapAround:s>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:F},n):(0,N.Qp)({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R,datumTransformation:k,rasterTransform:p,hasWrapAround:s>0||M,isAdaptive:!1,includeGCSGrid:F});let P;const Z=!n.requestRawData,D={rows:O.spacing[0],cols:O.spacing[1]},z=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,y.extent.xmin):void 0,{pixelBlocks:A,mosaicSize:E,isPartiallyFilled:J}=y;let L=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:E,destDimension:Z?{width:t,height:i}:null,coefs:Z?O.coefficients:null,sampleSpacing:Z?D:null,projectDirections:F,gcsGrid:F?O.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:n.interpolation,alignmentInfo:z,blockWidths:null},n);({pixelBlock:P,localNorthDirections:L}=e)}else{const e=(0,$.us)(A,E,{alignmentInfo:z});P=Z?(0,$.Uk)(e,{width:t,height:i},O.coefficients,D,n.interpolation):e,F&&O.gcsGrid&&(L=(0,$.Qh)({width:t,height:i},O.gcsGrid),P=(0,V.xQ)(P,this.rasterInfo.dataType,L))}return n.requestRawData||F?{extent:e,srcExtent:l,srcTilePixelSize:_,pixelBlock:P,transformGrid:O,localNorthDirections:L,isPartiallyFilled:J}:{extent:e,srcExtent:l,srcTilePixelSize:_,pixelBlock:P}}async _fetchRawTiles(e,t,i,n){const{origin:s,blockBoundary:r}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const p=this._getRasterTileAlignmentInfo(e,0);n.buffer&&(l-=n.buffer.cols,c-=n.buffer.rows,u+=2*n.buffer.cols,h+=2*n.buffer.rows);let d=0,m=0,y=0;f&&null!=p&&(({worldColumnCountFromOrigin:m,originColumnOffset:y,rightPadding:d}=p),m*p.blockWidth-d>=l+u&&(d=0));const g=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+d-1)/a),b=Math.floor((c+h+d-1)/o),v=r[e];if(!v)return null;const{minRow:I,minCol:_,maxCol:S,maxRow:R}=v;if(0===f&&(b<I||w<_||x>R||g>S))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?n.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=b;t++)for(let i=g;i<=w;i++){let s=i;if(!n.disableWrapAround&&f&&null!=p&&m<=i&&(s=i-m-y),t>=I&&s>=_&&R>=t&&S>=s){const i=this._fetchRawTile(e,t,s,n);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const M=await Promise.all(T),F={height:(b-x+1)*o,width:(w-g+1)*a},{spatialReference:O}=this.rasterInfo,P=this.getPyramidPixelSize(e),{x:Z,y:D}=P;return{extent:new X.Z({xmin:s.x+g*a*Z,xmax:s.x+(w+1)*a*Z,ymin:s.y-(b+1)*o*D,ymax:s.y-x*o*D,spatialReference:O}),pixelBlocks:M,mosaicSize:F,isPartiallyFilled:C}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,n){const s=this.rasterInfo.storageInfo.blockBoundary[e];if(!s)return Promise.resolve(null);const{minRow:r,minCol:a,maxCol:o,maxRow:l}=s;if(t<r||i<a||t>l||i>o)return Promise.resolve(null);const u=L(this.url,n.sliceId),h=`${e}/${t}/${i}`;let f=W(u,n.registryId,h);if(null==f){const s=new AbortController;f=this.fetchRawTile(e,t,i,{...n,signal:s.signal}),q(u,n.registryId,h,f,s),f.catch((()=>j(u,n.registryId,h)))}return n.signal&&(0,c.fu)(n,(()=>{H(u,n.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const n=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[s,r]=e,a=[],o=[];for(let e=0;e<n;e++){const[t,i]=(0,V.Tg)([s[e],r[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,N.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,n={}){const s={datumTransformation:n.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};n.srcResolution&&(s.srcResolution=n.srcResolution,this._updateSourceDataInfo(e,s));const r=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=s,c=a/t,u=o/i,h=l<r&&c*u>=16,f=l===r&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new B.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,N.VO)(a,this.rasterInfo.spatialReference,e,s.datumTransformation);const f=!o||n.srcResolution&&o.x+o.y<n.srcResolution.x+n.srcResolution.y;if(h&&n.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(r-l+3>=e){const t=2**e;o={x:n.srcResolution.x*t,y:n.srcResolution.y*t}}}o&&(s.srcResolution=o,this._updateSourceDataInfo(e,s))}return this._requireTooManySrcTiles(s.srcWidth,s.srcHeight,t,i)&&(s.srcWidth=0,s.srcHeight=0),s}_requireTooManySrcTiles(e,t,i,n){const{tileInfo:s}=this.rasterInfo.storageInfo;return Math.ceil(e/s.size[0])*Math.ceil(t/s.size[1])>=256||e/i>8||t/n>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,n=i.spatialReference,{srcResolution:s,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,N.kr)(s,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,N.tB)(e,n,r);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,p=Math.floor((c.xmin-h)/o.x+.1),d=Math.floor((f-c.ymax)/o.y+.1),m=Math.floor((c.xmax-h)/o.x-.1),y=Math.floor((f-c.ymin)/o.y-.1),g=c.width<.1*o.x?0:m-p+1,x=c.height<.1*o.y?0:y-d+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=g,t.srcHeight=x,t.ul={x:p,y:d}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:n,pyramidLevel:s,useTransposedTile:r}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[n])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!r){const t=e.pixels.map((e=>e[n])),r={location:i,value:t,pyramidLevel:s},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(r.magdirValue=a.map((e=>e[0]))),r}let l=e.pixels.map((e=>e.slice(n*a,n*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,A.MO)(o,h.transposedVariableName);if(u){const e=(0,A.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const p=e.noDataValues||this.rasterInfo.noDataValue,d={pixels:l,pixelType:e.pixelType};let m;return null!=p&&((0,G.A)(d,p),m=d.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===m?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new C.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:s}}};(0,n._)([(0,h.Cb)()],Y.prototype,"_rasterTileAlighmentInfo",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],Y.prototype,"_isGlobalWrappableSource",null),(0,n._)([(0,h.Cb)({readOnly:!0})],Y.prototype,"_hasNoneOrGCSShiftTransform",null),(0,n._)([(0,h.Cb)()],Y.prototype,"rasterJobHandler",null),(0,n._)([(0,h.Cb)(T.HQ)],Y.prototype,"url",null),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetName",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"hasUniqueSourceStorageInfo",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)()],Y.prototype,"sourceJSON",void 0),Y=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.BaseRaster")],Y);const K=Y;var Q=i(74889);let ee=class extends K{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:n}=this.primaryRasters,s=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(s);const r=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:r,rasterIds:n});if(!o.success||0===r.length)throw new a.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=Q.Z.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=r[0];this.hasUniqueSourceStorageInfo=1===r.length||r.slice(1).every((e=>this._hasSameStorageInfo(e,c))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,n={}){const{rasters:s,rasterIds:r}=this.primaryRasters;let a=!1;const{interpolation:o}=n,l=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!n.requestRawData&&"bilinear"!==o&&l&&(a=1===s.length&&!n.skipRasterFunction,n={...n,interpolation:"bilinear",requestRawData:a});const c=s.map((s=>s.fetchPixels(e,t,i,n))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||n.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(n.skipRasterFunction||h.every((e=>null==e)))return u[0];const p=u.find((e=>null!=e.pixelBlock))?.extent??e,d=this.rasterJobHandler?await this.rasterJobHandler.process({extent:p,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}):this.rasterFunction.process({extent:p,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}),{transformGrid:m}=u[0];if(!a||null==d||null==m)return{...u[0],pixelBlock:d};const y={rows:m.spacing[0],cols:m.spacing[1]};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[d],srcMosaicSize:{width:d.width,height:d.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:y,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},n)).pixelBlock:(0,$.Uk)(d,{width:t,height:i},m.coefficients,y,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:n,spatialReference:s,extent:r}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return n.x===o.x&&n.y===o.y&&s.equals(l)&&r.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],ee.prototype,"tileType",void 0),(0,n._)([(0,h.Cb)()],ee.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],ee.prototype,"primaryRasters",void 0),ee=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.FunctionRaster")],ee);const te=ee;var ie=i(67900),ne=i(5847);var se=i(5154),re=i(15612),ae=i(67058),oe=i(72758),le=i(79681),ce=i(23808),ue=i(82971);const he=o.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),fe=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",(0,R.Nm)(e,he))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,i){const n=t?.layerDefinition?.drawingInfo?.renderer;return(0,v.ij)(n,i)||void 0}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,V.KC)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.TJ)(le.Z,e).clone();const{rasterInfo:n}=this,{geometry:s}=e;if(null==s)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let r=s;const{spatialReference:o}=n;s.spatialReference.equals(o)||(await(0,N.zD)(),r="extent"===s.type?(0,N.tB)(s,o):(0,N.Wt)(s,o));const l=e.pixelSize??new B.Z({x:n.pixelSize.x,y:n.pixelSize.y,spatialReference:o}),{extent:c,width:u,height:h}=function(e,t,i,n=!0){const{spatialReference:s}=e,{x:r,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,ie.c9)(e.spatialReference),n=(0,ie.c9)(t);if(i===n)return e;const s=i/n;return{x:e.x*s,y:e.y*s}}(i,s);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:p,ymin:d}=u;const{xmin:m,ymax:y}=e.extent;return n?(h=m+(h>m?r*Math.round((h-m)/r):0),p=y-(p<y?a*Math.round((y-p)/a):0),f=m+(f>m?r*Math.round((f-m)/r):0),d=y-(d<y?a*Math.round((y-d)/a):0),o=new X.Z({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:s}),l=Math.round(o.width/r),c=Math.round(o.height/a)):(l=Math.floor((f-h)/r+.8),c=Math.floor((p-d)/a+.8),h=m+(h>m?r*Math.floor((h-m)/r+.1):0),p=y-(p<y?a*Math.floor((y-p)/a+.1):0),f=h+l*r,d=p-c*a,o=new X.Z({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:s})),{extent:o,width:l,height:c}}(n,r,l),p=await this.fetchPixels(c,u,h,{...t,interpolation:"nearest"});if(null==p.pixelBlock)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const d=await async function(e,t,n){if("extent"===n.type)return function(e,t,i){const{width:n,height:s}=e,r=new Uint8Array(n*s),a=t.width/n,o=t.height/s;if(i.width/a<.5||i.height/o<.5)return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:r,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:p,ymin:d,ymax:m}=i,y=Math.max(l,f),g=Math.min(c,p),x=Math.max(u,d),w=Math.min(h,m),b=.5*a,v=.5*o;if(g-y<b||w-x<v||g<l+b||y>c-b||x>h-v||w<u+v)return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:r,pixels:[...e.pixels]});const I=Math.max(0,(y-l)/a),_=Math.min(n,Math.max(0,(g-l)/a)),S=Math.max(0,(h-w)/o),R=Math.min(s,Math.max(0,(h-x)/o)),T=Math.round(I),C=Math.round(_)-1,k=Math.round(S),M=Math.round(R)-1;if(T===C&&I%1>.5&&_%1<.5||k===M&&S%1>.5&&R%1<.5)return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:r,pixels:[...e.pixels]});if(0===T&&0===k&&C===n&&M===s)return e;const F=e.mask;for(let e=k;e<=M;e++)for(let t=T;t<=C;t++){const i=e*n+t;r[i]=F?F[i]:255}return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:r,pixels:[...e.pixels]})}(e,t,n);const{width:s,height:r}=e,a=new Uint8Array(s*r),{contains:o,intersects:l}=await Promise.all([i.e(5837),i.e(1433)]).then(i.bind(i,61433));return l(t,n)?"polyline"===n.type?function(e,t,i){const{width:n,height:s}=e,r=new Uint8Array(n*s),a=t.width/n,o=t.height/s,{xmin:l,ymax:c}=t,{paths:u}=i,h=e.mask;for(let e=0;e<u.length;e++){const t=u[e];for(let e=0;e<t.length-1;e++){const[i,u]=t[e],[f,p]=t[e+1];let d=Math.floor((c-u)/o),m=Math.floor((c-p)/o);if(m<d){const e=d;d=m,m=e}d=Math.max(0,d),m=Math.min(s-1,m);const y=(f-i)/(p-u);for(let e=d;e<=m;e++){const t=e===d?Math.max(u,p):(s+1-e)*o,c=e===m?Math.min(u,p):t-o;let g=p===u?Math.floor((i-l)/a):Math.floor((y*(t-u)+i-l)/a),x=p===u?Math.floor((f-l)/a):Math.floor((y*(c-u)+i-l)/a);if(x<g){const e=g;g=x,x=e}const w=e*n;g=Math.max(0,g),x=Math.min(n-1,x);for(let e=w+g;e<=w+x;e++)r[e]=h?h[e]:255}}}return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:r,pixels:[...e.pixels]})}(e,t,n):o(n,t)?e:function(e,t,i){if(!e)return e;const{width:n,height:s}=e,r=t.width/n,a=t.height/s,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/r,t=(i.xmax-o)/r,n=(l-i.ymax)/a,s=(l-i.ymin)/a;c=[[[e,n],[e,s],[t,s],[t,n],[e,n]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/r,(l-t)/a]))));const u=document.createElement("canvas");u.width=n,u.height=s;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,n,s).data,p=e.mask,d=n*s,m=new Uint8Array(d);for(let e=0;e<d;e++)p&&!p[e]||(m[e]=f[4*e+3]>127?255:0);return new ne.Z({pixelType:e.pixelType,width:n,height:s,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,n):new ne.Z({pixelType:e.pixelType,width:s,height:r,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}(p.pixelBlock,c,r),m=this._rasterJobHandler.instance;return m?m.computeStatisticsHistograms({pixelBlock:d},t):(0,re.js)(d)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,ce.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=e.timeExtent||this.timeExtent;if(null!=i&&null!=n&&(null!=n.start||null!=n.end)){i=i.map((e=>e.clone()));const s=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),r=i.find((({dimensionName:e})=>"StdTime"===e));if(!s||!r)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=n,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=s.values){const e=s.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>{const i=Array.isArray(e)?e[0]:e,n=Array.isArray(e)?e[1]:e,s=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:t;return u===h?i-s:Math.abs(n-h)-Math.abs(r-h)}))[0];r.values=[t]}else i=null}else if(s.hasRegularIntervals&&s.extent){const[e,t]=s.extent;u>t||h<e?i=null:r.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,A.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",M.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:n}=this;if(n){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const s=(0,se.Ue)(n.functionDefinition?.toJSON()??n.toJSON(),i),r=new te({rasterFunction:s});r.rasterJobHandler=this._rasterJobHandler.instance,await r.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=r}else this.raster=t,this._cachedRasterFunctionJson=null,await t.when();if(this._cachedRendererJson=null,!i&&!n)return;const{bandIds:s}=this,{bandCount:r}=this.raster.rasterInfo,a=s?.length?s.some((e=>e>=r)):r>=3;s&&(a||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:i}=this.raster,n=(0,A.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=n?.name,r=(0,ae.ol)({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(r))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,ae.FI)(i,s),t.rendererJSON=r,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=r)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let n;await this.updateRenderer();const s=this._rasterJobHandler.instance,r=this.bandIds??[];return n=s?await s.symbolize({...e,simpleStretchParams:t,bandIds:r}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:r}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const n=(0,S.C5)(e);return O.Z.create({size:256,spatialReference:e,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,n={}){if(s(this),n.requestAsImageElement){const s=this.getTileUrl(e,t,i);return(0,I.Z)(s,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then((e=>e.data))}const{rasterInfo:r}=this;if(null!=r.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition){const s=n.tileInfo||r.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,i,s),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,i,n)}async fetchPixels(e,t,i,n={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,n))}async identify(e,t={}){const{raster:i,rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&!(n.hasMultidimensionalTranspose&&((0,A.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const s=this.multidimensionalSubset?.areaOfInterest;if(s&&!s.contains(e))throw new a.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,A.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new F.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{s(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){s(this);const{raster:e}=this,t=(0,ae.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){s(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,ae.YD)(t));const i=(0,A.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=i?.name;if(!this.renderer||"override"===e){const e=(0,ae.Ob)(t,{bandIds:this.bandIds,variableName:n}),i=t.statistics,s=i&&i.length>0?i[0]:null,r=s?.max??0,a=s?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(r>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const r=(0,ae.ol)({...this.renderer.toJSON(),variableName:n}),a=(0,ae.FI)(t,n);this.symbolizer?(this.symbolizer.rendererJSON=r,this.symbolizer.rasterInfo=a):this.symbolizer=new oe.Z({rendererJSON:r,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=(0,ae.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else he.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function s(e){if(!e.raster||!e.rasterInfo)throw new a.Z("imagery-tile","no raster")}return(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"_cachedRendererJson",void 0),(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"_cachedRasterFunctionJson",void 0),(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"_compatibleFullExtent",void 0),(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"_rasterJobHandler",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,n._)([(0,h.Cb)()],t.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)({type:[C.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,n._)([(0,h.Cb)({type:k.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"raster",void 0),(0,n._)([(0,h.Cb)({type:M.Z,json:{name:"renderingRule",write:!0}})],t.prototype,"rasterFunction",null),(0,n._)([(0,h.Cb)()],t.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:ue.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,n._)([(0,h.Cb)({type:O.Z})],t.prototype,"tileInfo",void 0),(0,n._)([(0,h.Cb)(T.HQ)],t.prototype,"url",null),(0,n._)([(0,h.Cb)({types:v.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:v.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,n._)([(0,_.r)("renderer")],t.prototype,"readRenderer",null),(0,n._)([(0,h.Cb)({clonable:!1})],t.prototype,"symbolizer",void 0),t=(0,n._)([(0,y.j)("esri.layers.ImageryTileMixin")],t),t};var pe=i(38009),de=i(16859),me=i(34760),ye=i(72965),ge=i(28294),xe=i(1231),we=i(69608),be=i(25972),ve=i(20095);function Ie(e){const t=e.fields,i=e.records,n=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",s=[{name:n,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),r=s.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[n]=o++,l=1;l<r.length;l++)t[r[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:s,features:a}}class _e{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const n=t.getUint32(4,!0),s=t.getUint16(8,!0),r=t.getUint16(10,!0),a={version:i,recordCount:n,headerByteCount:s,recordByteCount:r};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,ve.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<n&&e.byteLength-o>r;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,ve.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const n=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(n.substring(0,4),10),parseInt(n.substring(4,6),10)-1,parseInt(n.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=r}}return{header:a,fields:l,records:c,recordSet:Ie({fields:l,records:c})}}}var Se=i(87521);const Re=new Map;Re.set("int16","esriFieldTypeSmallInteger"),Re.set("int32","esriFieldTypeInteger"),Re.set("int64","esriFieldTypeInteger"),Re.set("float32","esriFieldTypeSingle"),Re.set("float64","esriFieldTypeDouble"),Re.set("text","esriFieldTypeString");let Te=class extends K{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new a.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:n}=this._parseHeader(t);if("thematic"===n.dataType){const e=await this._fetchAuxiliaryInformation();n.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",n),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,n={}){const{transposeInfo:s}=this.rasterInfo.storageInfo,{transposedVariableName:r}=n,a=!(!s||!r),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,n.multidimensionalDefinition,r),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:n.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const p=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:n.signal});if(!p)return null;const[d,m]=this._getTileSize(a);return this.decodePixelBlock(p.data,{width:d,height:m,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,colormap:n,blockWidth:s,blockHeight:r,firstPyramidLevel:a,maximumPyramidLevel:o}=e,l=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),c=e.histograms?.[0]?.counts?.length?e.histograms:null,u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ue.Z(u?.wkid||u?.wkt||u?.wkt2?u:h);let p=new X.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const d=new B.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),m=Math.round((p.xmax-p.xmin)/d.x),y=Math.round((p.ymax-p.ymin)/d.y),g=this._parseTransform(e.geodataXform),x=g?p:null;g&&(p=g.forwardTransform(p),d.x=(p.xmax-p.xmin)/m,d.y=(p.ymax-p.ymin)/y);const w=e.properties??{},b=e.format.toLowerCase().replace("cache/",""),v=new B.Z(e.origin.x,e.origin.y,f);let I,_,S,R;if(n&&n.colors)for(I=[],_=0;_<n.colors.length;_++)S=n.colors[_],R=n.values?n.values[_]:_,I.push([R,255&S,S<<16>>>24,S<<8>>>24,S>>>24]);const T=e.LODInfos,C=[];for(_=0;_<T.levels.length;_++)C.push(new D.Z({level:T.levels[_],resolution:T.resolutions[_],scale:96/.0254*T.resolutions[_]}));const k=new O.Z({dpi:96,lods:C,format:b,origin:v,size:[s,r],spatialReference:f}),M={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},F=[{maxCol:Math.ceil(m/s)-1,maxRow:Math.ceil(y/r)-1,minCol:0,minRow:0}];let P=2;if(o>0)for(_=0;_<o;_++)F.push({maxCol:Math.ceil(m/P/s)-1,maxRow:Math.ceil(y/P/r)-1,minCol:0,minRow:0}),P*=2;const Z=e.mdInfo;let A=null;if(Z&&w._yxs){const e=w._yxs;A={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:M,rasterInfo:new be.Z({width:m,height:y,pixelType:t,bandCount:i,extent:p,nativeExtent:x,transform:g,spatialReference:f,pixelSize:d,keyProperties:w,statistics:l,histograms:c,multidimensionalInfo:Z,colormap:I,storageInfo:new z.Z({blockWidth:s,blockHeight:r,pyramidBlockWidth:s,pyramidBlockHeight:r,origin:v,tileInfo:k,transposeInfo:A,firstPyramidLevel:a,maximumPyramidLevel:o,blockBoundary:F})})}}_parseTransform(e){if(!(0,Se.j)(e))throw new a.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,Se.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),n=await Promise.all([t,i]);let s;if(n[0]){let e=n[0].fields;const t=n[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":Re.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(s={fields:e,features:i})}}return!s&&n[1]&&(s=_e.parse(n[1]).recordSet),Q.Z.fromJSON(s)}_buildCacheFilePath(e,t,i,n,s){const r=this._getPackageSize(!!s),a=Math.floor(t/r)*r,o=Math.floor(i/r)*r,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=n?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!s){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const p=this._getVariableFolderName(s||h.variableName);return`${this.url}/_alllayers/${p}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replaceAll(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const n=this._getPackageSize(i),s=n*(e%n)+t%n;if(s<0)throw new Error("Invalid level / row / col");return 20+s*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let n,s=0;for(n=0;n<5;n++)s|=(255&i[n])<<8*n;const r=0xffffffffff&s;for(s=0,n=5;n<8;n++)s|=(255&i[n])<<8*(n-5);return{position:r,recordSize:0xffffffffff&s}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,n._)([(0,h.Cb)({readOnly:!0})],Te.prototype,"storageInfo",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.CloudRaster")],Te);const Ce=Te;let ke=class extends K{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:n,histograms:s,name:r,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new X.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ue.Z({wkid:3857})}),p=t.isPseudoSpatialReference??!t.extent,d={x:f.width/c,y:f.height/u},m=new be.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:d,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:n,isPseudoSpatialReference:p,histograms:s});this.createRemoteDatasetStorageInfo(m,512,512),this._set("rasterInfo",m),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=r,this.url="/InMemory/"+r}fetchRawTile(e,t,i,n={}){const s=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(s)}async _buildInMemoryRaster(e,t,i){const n=this.rasterInfo.storageInfo.maximumPyramidLevel,s=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve((0,$.Vl)(e,t,n)),r=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,l=r?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,re.Hv)(e)),u=await(0,c.as)([s,l]);if(!u[0].value&&u[1].value)throw new a.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,r||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],ke.prototype,"data",void 0),ke=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],ke);const Me=ke;function Fe(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=[];if(t){const s=Fe(e,i);for(let e=0;e<s.length;e++)Fe(s[e],t).forEach((e=>n.push(e)));return n}const s=e.getElementsByTagNameNS("*",i);if(!s||0===s.length)return[];for(let e=0;e<s.length;e++)n.push(s[e]||s.item(e));return n}function Oe(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=Fe(e,i);return n.length>0?t?Oe(n[0],t):n[0]:null}function Pe(e,t=null){const i=t?Oe(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function Ze(e,t){return function(e,t){const i=Fe(e,t),n=[];let s;for(let e=0;e<i.length;e++)s=i[e].textContent||i[e].nodeValue,s&&(s=s.trim(),""!==s&&n.push(s));return n}(e,t).map((e=>Number(e)))}function De(e,t){const i=Pe(e,t);return Number(i)}function ze(e,t){const i=e?.nodeName?.toLowerCase(),n=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===n}var Ae=i(87390);function Ne(e,t){if(!e||!t)return null;const i=[];for(let n=0;n<e.length;n++)i.push(e[n]),i.push(t[n]);return i}function Be(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ue.Z({wkid:t});if(e=String(e).trim(),(0,S.xl)(e))return new ue.Z({wkt2:e});const i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;const n=i.indexOf("VERTCS"),s=i.indexOf("PROJCS"),r=s>-1?s:i.indexOf("GEOGCS");if(-1===r)return null;const a=e.slice(r,e.lastIndexOf("]",n)+1).trim(),o=e.slice(n,e.lastIndexOf("]")).trim();t=Ee(a);const l=new ue.Z(t?{wkid:t}:{wkt:a}),c=Ee(o);return c&&(l.vcsWkid=c),l}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=Ee(e),new ue.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ee(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),n=i[0]?.toLowerCase();if(("epsg"===n||"esri"===n)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Je(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(ze(e,"SRS")){if(!t.spatialReference){const i=Pe(e);t.spatialReference=Be(i)}}else if(ze(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:n}=function(e){const t=Oe(e,"GeodataXform"),i=Be(De(t,"SpatialReference/WKID")||Pe(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const n=De(t,"PolynomialOrder")??1,s=Ze(t,"CoeffX/Double"),r=Ze(t,"CoeffY/Double"),a=Ze(t,"InverseCoeffX/Double"),o=Ze(t,"InverseCoeffY/Double"),l=Ne(s,r),c=Ne(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Ae.Z({spatialReference:i,polynomialOrder:n,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=n,t.spatialReference||(t.spatialReference=i)}else Fe(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=Pe(e)));else if(ze(e,"PAMRasterBand")){const i=function(e){const t=De(e,"NoDataValue"),i=Oe(e,"Histograms/HistItem"),n=De(i,"HistMin"),s=De(i,"HistMax"),r=De(i,"BucketCount"),a=Pe(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Fe(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=De(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=n&&null!=s?{min:n,max:s,size:r||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(p.pC):null;const n=!!i[0].histogram;t.histograms=n?i.map((e=>e.histogram)).filter(p.pC):null}return t}let Le=class extends K{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:s,transform:r}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ue.Z({wkid:3857})),s?.length&&null==n&&(n=(0,re.Oh)(s));const{width:o,height:l}=t;let c=new X.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=r?r.forwardTransform(c):c;let h=!0;if(r){const e=r.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(r=null,c=u)}const f=new Me({data:{extent:u,nativeExtent:c,transform:r,pixelBlock:t,statistics:n,histograms:s,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,n={}){return this._inMemoryRaster.fetchRawTile(e,t,i,n)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,U.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const n=i.toLowerCase(),s="gif"===n||"bmp"===n||!(0,d.Z)("ios"),r=await this.decodePixelBlock(t,{format:n,useCanvas:s,hasNoZlibMask:!0});if(null==r)throw new a.Z("image-aux-raster:open","the data cannot be decoded");return r}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],n=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,r="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,a=r&&i.includes(r)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+r,{responseType:"text",signal:t}),o=await(0,c.as)([n,a]);if(t?.aborted)throw(0,c.zE)();const l=Je(o[0].value?.data);if(!l.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;l.transform=6===e?.length?new Ae.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return l}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Le.prototype,"datasetFormat",void 0),Le=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],Le);const He=Le;var We=i(70586),qe=i(17452),je=i(28589),Ge=i(29680),Ue=i(26059);let $e=class extends K{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const n=i.data;if(this.sourceJSON=n,!n)throw new a.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new a.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=n.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(n.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===n.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=n.name?.slice(n.name.indexOf("/")+1)??"";const s=await this._fetchRasterInfo({signal:t});if(null==s)throw new a.Z("image-server-raster:open","cannot initialize image service");(0,Ue.n$)(s,n);const r="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:n,minLOD:s,maxLOD:r}=t;if(null!=s&&null!=r)return O.Z.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=s&&e<=r))});if(0!==i&&0!==n){const t=e=>Math.round(1e4*e)/1e4,s=i?t(i):1/0,r=n?t(n):-1/0;return O.Z.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=s&&i>=r}))})}return O.Z.fromJSON(e)}(n.tileInfo,n):O.Z.fromJSON(n.tileInfo);(0,We.O3)(r);const[o,l]=this._computeMinMaxLOD(s,r),{extent:c,pixelSize:u}=s,h=.5/s.width*u.x,f=Math.max(u.x,u.y),{lods:p}=r;("Map"!==this.tileType&&0!==n.maxScale||Math.abs(u.x-u.y)>h||!p.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,s.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),s.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const d=o.level-l.level,[m,y]=r.size,g=[],x=[];p.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<p.length-1&&x.push(Math.round(10*e.resolution/p[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,y,r.origin,g,d),b=g.length>1?g.slice(1):null;let v;n.transposeInfo&&(v={tileSize:[n.transposeInfo.rows,n.transposeInfo.cols],packetSize:s.keyProperties?._yxs.PacketSize??0});const I=x.length<=1||x.length>=3&&x.slice(0,-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/d))/10;if(s.storageInfo=new z.Z({blockWidth:r.size[0],blockHeight:r.size[1],pyramidBlockWidth:r.size[0],pyramidBlockHeight:r.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:r.format,origin:r.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:r,transposeInfo:v,blockBoundary:w}),this._fixGCSShift(s),this._set("rasterInfo",s),n.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:s.storageInfo.tileInfo,parsedUrl:(0,qe.mN)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new je.y({layer:e})}}async fetchRawTile(e,t,i,n={}){const{storageInfo:s,extent:r}=this.rasterInfo,{transposeInfo:a}=s,o=null!=a&&!!n.transposedVariableName;if(this._slices&&!o&&null==n.sliceId)return null;const l=o?0:s.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:n.transposedVariableName}:{sliceId:n.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:n.signal});if(!h)return null;const f=o?a.tileSize:s.tileInfo.size,p=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==p)return null;const d=s.blockBoundary[e];if("jpg"!==s.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return p;const{origin:m,blockWidth:y,blockHeight:g}=s,{x,y:w}=this.getPyramidPixelSize(e),b=Math.round((r.xmin-m.x)/x)%y,v=Math.round((r.xmax-m.x)/x)%y||y,I=Math.round((m.y-r.ymax)/w)%g,_=Math.round((m.y-r.ymin)/w)%g||g,S=i===d.minCol?b:0,R=t===d.minRow?I:0,T=i===d.maxCol?v:y,C=t===d.maxRow?_:g;return(0,$.pW)(p,{x:S,y:R},{width:T-S,height:C-R}),p}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),n=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([i,n]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),s[1]?.[0]?.counts?.length||(s[1]=null),{statistics:s[0]||null,histograms:s[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let n=0;const{maximumPyramidLevel:s}=this.rasterInfo.storageInfo;let r=s-n+this._levelOffset;const a=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,n++,i=this.identifyPixelLocation(a,n,t.datumTransformation),null===i)return null}return-1===r||null==i?null:n}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),n=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),s=ue.Z.fromJSON(t.spatialReference||e.spatialReference),r=new B.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:s});return new be.Z({width:i,height:n,bandCount:3,extent:X.Z.fromJSON(e),spatialReference:s,pixelSize:r,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,n=(0,Ue.gh)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),s=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,r=await Promise.all([n,s]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new Ge.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,n=.5/e.width*i.x,{lods:s}=t,r=t.lodAt(Math.max.apply(null,s.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,s.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=s[0].level,[r,a];if("Raster"===o)return[s.find((e=>e.resolution===i.x))??r,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=s.find((e=>Math.abs(e.scale-c)<n)),u||(u=s.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??r));let h=a;return l>0&&(h=s.find((e=>Math.abs(e.scale-l)<n))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],$e.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],$e.prototype,"tileType",void 0),$e=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],$e);const Ve=$e;var Xe=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Ke=new Map;Ke.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ke.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ke.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ke.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Qe=class extends K{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:n,files:s}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(n.statistics=t.statistics??n.statistics,n.histograms=t.histograms,t.histograms&&null==n.statistics&&(n.statistics=(0,re.Oh)(t.histograms)))}this._set("rasterInfo",n),this._files=s;const r=await this.request(s.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(r.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let p=0,d=-1;for(;p<this._storageIndex.length;){d++;const e=Math.ceil(c/a/l**d)-1,t=Math.ceil(u/o/l**d)-1;p+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,d>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=d),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:s,blockHeight:r,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(s*r);return new ne.Z({width:s,height:r,pixels:null,mask:e,validPixelCount:0})}const{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<d;y++)p&&!p.includes(y)||m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:n.signal}));const g=await Promise.all(m),x=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let b=0;for(y=0;y<d;y++)w.set(new Uint8Array(g[y].data),b),b+=g[y].data.byteLength;const v=Ke.get(this.rasterInfo.storageInfo.compression).decoderFormat,I=await this.decodePixelBlock(w.buffer,{width:s,height:r,format:v,planes:p?.length||l,pixelType:c});if(null==I)return null;let{noDataValue:_}=this.rasterInfo;if(null!=_&&"lerc"!==v&&!I.mask&&(_=_[0],null!=_)){const e=I.width*I.height,t=new Uint8Array(e);if(Math.abs(_)>1e24)for(y=0;y<e;y++)Math.abs((I.pixels[0][y]-_)/_)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)I.pixels[0][y]!==_&&(t[y]=1);I.mask=t}let S=0,R=0;if(h!==s||f!==r){let e=I.mask;if(e)for(y=0;y<r;y++)if(R=y*s,y<f)for(S=h;S<s;S++)e[R+S]=0;else for(S=0;S<s;S++)e[R+S]=0;else for(e=new Uint8Array(s*r),I.mask=e,y=0;y<f;y++)for(R=y*s,S=0;S<h;S++)e[R+S]=1}return I}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,n,s,r,a;if(Xe.f){for(i=new Uint8Array(e),s=new ArrayBuffer(e.byteLength),n=new Uint8Array(s),r=0;r<e.byteLength/4;r++)for(a=0;a<4;a++)n[4*r+a]=i[4*r+3-a];t=new Uint32Array(s)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Ke.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:n,blockHeight:s,pyramidScalingFactor:r}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,p=0;for(h=0;h<e;h++)p=r**h,c=Math.ceil(a/n/p),u=Math.ceil(o/s/p),f+=c*u;p=r**e,c=Math.ceil(a/n/p),u=Math.ceil(o/s/p),f+=t*c+i,f*=4*l;const d=this._storageIndex.subarray(f,f+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=d[4*e]*2**32+d[4*e+1],y=m+d[4*e+2]*2**32+d[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?n:Math.ceil(a/p)-n*(c-1),actualTileHeight:t<u-1?s:Math.ceil(o/p)-s*(u-1)}}_parseHeader(e){const t=Oe(e,"MRF_META/Raster");if(!t)throw new a.Z("mrf:open","not a valid MRF format");const i=Oe(t,"Size"),n=parseInt(i.getAttribute("x"),10),s=parseInt(i.getAttribute("y"),10),r=parseInt(i.getAttribute("c"),10),o=(Pe(t,"Compression")||"none").toLowerCase();if(!Ke.has(o))throw new a.Z("mrf:open","currently does not support compression "+o);const l=Pe(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new a.Z("mrf:open","currently does not support pixel type "+l);const u=Oe(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),p=Oe(t,"DataValues");let d,m;if(p&&(m=p.getAttribute("NoData"),null!=m&&(d=m.trim().split(" ").map((e=>parseFloat(e))))),Oe(e,"MRF_META/CachedSource"))throw new a.Z("mrf:open","currently does not support MRF referencing other data files");const y=Oe(e,"MRF_META/GeoTags"),g=Oe(y,"BoundingBox");let x,w=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),n=parseFloat(g.getAttribute("maxy")),s=Pe(y,"Projection")||"";let r=ue.Z.WGS84;if("LOCAL_CS[]"!==s)if(s.toLowerCase().startsWith("epsg:")){const e=Number(s.slice(5));isNaN(e)||0===e||(r=new ue.Z({wkid:e}))}else r=Be(s)??ue.Z.WGS84;else w=!0,r=new ue.Z({wkid:3857});x=new X.Z(e,t,i,n),x.spatialReference=r}else w=!0,x=new X.Z({xmin:-.5,ymin:.5-s,xmax:n-.5,ymax:.5,spatialReference:new ue.Z({wkid:3857})});const b=Oe(e,"MRF_META/Rsets"),v=parseInt(b&&b.getAttribute("scale")||"2",10),I=x.spatialReference,_=new z.Z({origin:new B.Z({x:x.xmin,y:x.ymax,spatialReference:I}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:v}),S=new B.Z({x:x.width/n,y:x.height/s,spatialReference:I}),R=new be.Z({width:n,height:s,extent:x,isPseudoSpatialReference:w,spatialReference:I,bandCount:r,pixelType:c,pixelSize:S,noDataValue:d,storageInfo:_}),T=Pe(e,"datafile"),C=Pe(e,"IndexFile");return{rasterInfo:R,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Ke.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Je(t)}catch{return null}}};(0,n._)([(0,h.Cb)()],Qe.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],Qe.prototype,"_storageIndex",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Qe.prototype,"datasetFormat",void 0),Qe=(0,n._)([(0,y.j)("esri.layers.support.rasterIO.MRFRaster")],Qe);const et=Qe;var tt=i(94793),it=i(9832);const nt=(e,t)=>e.get(t)?.values,st=(e,t)=>e.get(t)?.values?.[0];let rt=class extends K{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new a.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:n,firstIFDPos:s,isBigTiff:r}=(0,tt.cK)(i),l=[];await this._readIFDs(l,i,n,s,0,r?8:4,t);const{imageInfo:c,rasterInfo:u}=this._parseIFDs(l),h=(0,tt.ee)(l),f=(0,tt.I7)(l);if(this._headerInfo={littleEndian:n,isBigTiff:r,ifds:l,pyramidIFDs:h,maskIFDs:f,...c},this._set("rasterInfo",u),!c.isSupported)throw new a.Z("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new a.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");u.isPseudoSpatialReference&&o.Z.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const p=l[0].get("PREDICTOR")?.values?.[0],d=l[0].get("SAMPLEFORMAT")?.values?.[0];if(3===d&&2===p)throw new a.Z("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:m=[]}=this.ioConfig;if(!m.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,u)}m.includes("vat.dbf")||1!==u.bandCount||"u8"!==u.pixelType||(u.attributeTable=await this._fetchAuxiliaryTable(e),null!=u.attributeTable&&(u.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const s=await this._fetchRawTiffTile(e,t,i,!1,n);if(null!=s&&this._headerInfo.hasMaskBand){const r=await this._fetchRawTiffTile(e,t,i,!0,n);null!=r&&r.pixels[0]instanceof Uint8Array&&(s.mask=r.pixels[0])}return s}_parseIFDs(e){const t=(0,tt.FI)(e),{width:i,height:n,tileWidth:s,tileHeight:r,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:p,affine:d,metadata:m}=t;let y=Be(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),g=!!t.isPseudoGeographic;null==y&&(g=!0,y=new ue.Z({wkid:3857}));const x=new X.Z({...t.extent,spatialReference:y}),w=new B.Z(x?{x:x.xmin,y:x.ymax,spatialReference:y}:{x:0,y:0}),b=new z.Z({blockWidth:s,blockHeight:r,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:p}),v=new B.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),I=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let _=null;const S=st(e[0],"PHOTOMETRICINTERPRETATION"),R=nt(e[0],"COLORMAP");if(S<=3&&R?.length>3&&R.length%3==0){_=[];const e=R.length/3;for(let t=0;t<e;t++)_.push([t,R[t]>>>8,R[t+e]>>>8,R[t+2*e]>>>8])}const T=new be.Z({width:i,height:n,bandCount:a,pixelType:o,pixelSize:v,storageInfo:b,spatialReference:y,isPseudoSpatialReference:g,keyProperties:I,extent:x,colormap:_,statistics:m?m.statistics:null});return d?.length&&(T.nativeExtent=new X.Z({xmin:-.5,ymin:.5-n,xmax:i-.5,ymax:.5,spatialReference:y}),T.transform=new Ae.Z({polynomialOrder:1,forwardCoefficients:[d[2]+d[0]/2,d[5]-d[3]/2,d[0],d[3],-d[1],-d[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new B.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),b.origin.x=-.5,b.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,re.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new B.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,n,s,r=4,a){if(!n)return null;(n>=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+s,to:n+s+this._bufferSize},responseType:"array-buffer",signal:a})).data,s=n+s,n=0);const o=await this._readIFD(t,i,n,s,it.Z.tiffTags,r,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-s,s,r,a)}async _readIFD(e,t,i,n,s=it.Z.tiffTags,r=4,a){if(!e)return null;const o=(0,tt.vr)(e,t,i,n,s,r);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const s=i.map((e=>e.offlineOffsetSize)).filter(p.pC),r=Math.min.apply(null,s.map((e=>e[0])));if(Math.min.apply(null,s.map((e=>e[0]+e[1])))-r<=this._bufferSize){const{data:s}=await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:a});e=s,n=r,i.forEach((i=>(0,tt.Dq)(e,t,i,n)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),s=i?.values;if(s&&s.length>4){const r=s[0]+"."+s[1]+"."+s[2],o=await this._readIFD(e,t,i.valueOffset+6-n,n,it.Z.geoKeys,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:n,to:n+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,n,it.Z.tiffTags,4,a)}}async _fetchRawTiffTile(e,t,i,n,s={}){const r=this._getTileLocation(e,t,i,n);if(!r)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=r,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===h.length?h[0].data:new ArrayBuffer(f),d=[0],m=[0];if(h.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){const n=h[t].data;e.set(new Uint8Array(n),i),d[t]=i,i+=n.byteLength,m[t]=n.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,b,v;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(v=w*y,w<l)for(b=o;b<y;b++)e[v+b]=0;else for(b=0;b<y;b++)e[v+b]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(v=w*y,b=0;b<o;b++)e[v+b]=1}return x}_getTileLocation(e,t,i,n=!1){const{firstPyramidLevel:s,blockBoundary:r}=this.rasterInfo.storageInfo,a=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const l=n?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,tt.If)(l,o),u=nt(l,"TILEOFFSETS");if(void 0===u)return null;const h=nt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:p,maxRow:d,maxCol:m}=r[a];if(t>d||i>m||t<f||i<p)return null;const y=st(l,"IMAGEWIDTH"),g=st(l,"IMAGELENGTH"),x=st(l,"TILEWIDTH"),w=st(l,"TILELENGTH"),b=[];if(c){const{bandCount:e}=this.rasterInfo;for(let n=0;n<e;n++){const e=n*(d+1)*(m+1)+t*(m+1)+i;b[n]={from:u[e],to:u[e]+h[e]-1}}}else{const e=t*(m+1)+i;b.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<b.length;e++)if(null==b[e].from||!b[e].to||b[e].to<0)return null;return{ranges:b,ifd:l,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Je(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=_e.parse(t);return i?.recordSet?Q.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,n._)([(0,h.Cb)()],rt.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],rt.prototype,"_headerInfo",void 0),(0,n._)([(0,h.Cb)()],rt.prototype,"_bufferSize",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],rt.prototype,"datasetFormat",void 0),rt=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.TIFFRaster")],rt);const at=rt,ot=new Map;ot.set("CRF",{desc:"Cloud Raster Format",constructor:Ce}),ot.set("MRF",{desc:"Meta Raster Format",constructor:et}),ot.set("TIFF",{desc:"GeoTIFF",constructor:at}),ot.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Ve}),ot.set("JPG",{desc:"JPG Raster Format",constructor:He}),ot.set("PNG",{desc:"PNG Raster Format",constructor:He}),ot.set("GIF",{desc:"GIF Raster Format",constructor:He}),ot.set("BMP",{desc:"BMP Raster Format",constructor:He});class lt{static get supportedFormats(){const e=new Set;return ot.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:n}=e;let s=e.datasetFormat;null==s&&t.lastIndexOf(".")&&(s=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===s||"TIF"===s?s="TIFF":"JPG"!==s&&"JPEG"!==s&&"JFIF"!==s||(s="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");const r={url:t,sourceJSON:n,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(s&&this.supportedFormats.has(s)){if("CRF"===s&&!i?.enableCRF)throw new a.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=ot.get(s).constructor,l=new o(r),await l.open({signal:e.signal}),l}if(s)throw new a.Z("rasterfactory:open","not a supported format "+s);const c=Array.from(ot.keys());let u=0;const h=()=>(s=c[u++],s&&("CRF"!==s||i?.enableCRF)?(o=ot.get(s).constructor,l=new o(r),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){ot.has(e.toUpperCase())||ot.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(32163),ut=i(12259);let ht=class extends((0,w.h)((0,ye.M)((0,pe.q)((0,de.I)((0,b.N)(fe((0,ge.n)((0,x.Y)((0,me.Q)((0,l.R)((0,r.J)(g.Z)))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=(0,c.Ds)((async(e,t,n)=>{const{save:s,saveAs:r}=await i.e(4697).then(i.bind(i,64697));switch(e){case ut.x.SAVE:return s(this,t);case ut.x.SAVE_AS:return r(this,n,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new xe.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new xe.Z({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:t}=this,i=t?.attributeTable,n=null!=i?i.fields:null;if(n){const t=n.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e.push(...t)}const s=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=r){const t=r.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new xe.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new xe.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,i=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return(0,ct.eZ)({fields:t,title:this.title},{...e,visibleFieldNames:i})}async generateRasterInfo(e,t){if(!(e=(0,f.TJ)(M.Z,e)))return this.rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const n=(0,se.Ue)(e.functionDefinition?.toJSON()??e.toJSON(),i),s=new te({rasterFunction:n});return await s.open(t),s.rasterInfo}catch(e){if(e instanceof a.Z)throw e;throw new a.Z("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(ut.x.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(ut.x.SAVE_AS,t,e)}write(e,t){const i=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,se.G8)(t.toJSON(),i);const n=await Promise.all(i.map((t=>lt.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),s=n.findIndex((e=>null==e));if(s>-1)throw new a.Z("imagery-tile-layer:open",`cannot open raster: ${i[s]}`);if(this._primaryRasters=n,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,se.Ue)(t.functionDefinition?.toJSON()??t.toJSON(),e),s=new te({rasterFunction:i});try{await s.open(),this.raster=s}catch(e){const t=o.Z.getLogger(this);e instanceof a.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const i=this.raster.rasterInfo;if(!i)throw new a.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,n._)([(0,h.Cb)({clonable:!1})],ht.prototype,"_primaryRasters",void 0),(0,n._)([(0,h.Cb)({type:[f.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ht.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,m.J)(we.cl)],ht.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)(T.rn)],ht.prototype,"legendEnabled",void 0),(0,n._)([(0,h.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ht.prototype,"isReference",void 0),(0,n._)([(0,h.Cb)({type:["show","hide"]})],ht.prototype,"listMode",void 0),(0,n._)([(0,h.Cb)({json:{read:!0,write:!0}})],ht.prototype,"blendMode",void 0),(0,n._)([(0,h.Cb)()],ht.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ht.prototype,"version",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{read:!1}})],ht.prototype,"type",void 0),(0,n._)([(0,h.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ht.prototype,"operationalLayerType",void 0),(0,n._)([(0,h.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ht.prototype,"popupEnabled",void 0),(0,n._)([(0,h.Cb)({type:s.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ht.prototype,"popupTemplate",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],ht.prototype,"defaultPopupTemplate",null),(0,n._)([(0,h.Cb)({readOnly:!0,type:[xe.Z]})],ht.prototype,"fields",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:[xe.Z]})],ht.prototype,"rasterFields",null),ht=(0,n._)([(0,y.j)("esri.layers.ImageryTileLayer")],ht);const ft=ht},39450:(e,t,i)=>{i.d(t,{Z:()=>u});var n,s=i(43697),r=i(96674),a=i(5600),o=i(75215),l=(i(67676),i(80442),i(52011));let c=n=class extends r.wq{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new n({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,s._)([(0,a.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"cols",void 0),(0,s._)([(0,a.Cb)({type:o.z8,json:{write:!0}})],c.prototype,"level",void 0),(0,s._)([(0,a.Cb)({type:String,json:{write:!0}})],c.prototype,"levelValue",void 0),(0,s._)([(0,a.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"origin",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{write:!0}})],c.prototype,"resolution",void 0),(0,s._)([(0,a.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"rows",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{write:!0}})],c.prototype,"scale",void 0),c=n=(0,s._)([(0,l.j)("esri.layers.support.LOD")],c);const u=c},11145:(e,t,i)=>{i.d(t,{Z:()=>S});var n,s=i(43697),r=i(35454),a=i(96674),o=i(67900),l=i(5600),c=i(75215),u=(i(67676),i(80442),i(71715)),h=i(52011),f=i(30556),p=i(94139),d=i(82971),m=i(24470),y=i(8744),g=i(40488),x=i(39450),w=i(43077);const b=new r.X({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let v=n=class extends a.wq{static create(e={}){const{resolutionFactor:t=1,scales:i,size:s=256,spatialReference:r=d.Z.WebMercator,numLODs:a=24}=e;if(!(0,y.JY)(r)){const e=[];if(i)for(let t=0;t<i.length;t++){const n=i[t];e.push(new x.Z({level:t,scale:n,resolution:n}))}else{let t=5e-4;for(let i=a-1;i>=0;i--)e.unshift(new x.Z({level:i,scale:t,resolution:t})),t*=2}return new n({dpi:96,lods:e,origin:new p.Z(0,0,r),size:[s,s],spatialReference:r})}const l=(0,y.C5)(r),c=e.origin?new p.Z({x:e.origin.x,y:e.origin.y,spatialReference:r}):new p.Z(l?{x:l.origin[0],y:l.origin[1],spatialReference:r}:{x:0,y:0,spatialReference:r}),u=1/(39.37*(0,o.c9)(r)*96),h=[];if(i)for(let e=0;e<i.length;e++){const t=i[e],n=t*u;h.push(new x.Z({level:e,scale:t,resolution:n}))}else{let e=(0,y.sT)(r)?512/s*591657527.5917094:256/s*591657527.591555;const i=Math.ceil(a/t);h.push(new x.Z({level:0,scale:e,resolution:e*u}));for(let n=1;n<i;n++){const i=e/2**t,s=i*u;h.push(new x.Z({level:n,scale:i,resolution:s})),e=i}}return new n({dpi:96,lods:h,origin:c,size:[s,s],spatialReference:r})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const i=(0,y.C5)(e);return e.isWrappable&&!!i&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return p.Z.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0;const n=[],s=this._levelToLOD={};e&&(t=-1/0,i=1/0,e.forEach((e=>{n.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,s[e.level]=e}))),this._set("scales",n),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const i=Math.floor(e),n=i+1;return t[i]/(t[i]/t[n])**(e-i)}scaleToZoom(e){const t=this.scales,i=t.length-1;let n=0;for(;n<i;n++){const i=t[n],s=t[n+1];if(i<=e)return n;if(s===e)return n+1;if(i>e&&s<e)return n+Math.log(i/e)/Math.log(i/s)}return n}snapScale(e,t=.95){const i=this.scaleToZoom(e);return i%Math.floor(i)>=t?this.zoomToScale(Math.ceil(i)):this.zoomToScale(Math.floor(i))}tileAt(e,t,i,n){const s=this.lodAt(e);if(!s)return null;let r,a;if("number"==typeof t)r=t,a=i;else if((0,y.fS)(t.spatialReference,this.spatialReference))r=t.x,a=t.y,n=i;else{const e=(0,g.iV)(t,this.spatialReference);if(null==e)return null;r=e.x,a=e.y,n=i}const o=s.resolution*this.size[0],l=s.resolution*this.size[1];return n||(n=new w.f(null,0,0,0,(0,m.Ue)())),n.level=e,n.row=Math.floor((this.origin.y-a)/l+.001),n.col=Math.floor((r-this.origin.x)/o+.001),this.updateTileInfo(n),n}updateTileInfo(e,t=n.ExtrapolateOptions.NONE){let i=this.lodAt(e.level);if(!i&&t===n.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return;const s=e.level-i.level,r=i.resolution*this.size[0]/2**s,a=i.resolution*this.size[1]/2**s;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,m.Ue)()),e.extent[0]=this.origin.x+e.col*r,e.extent[1]=this.origin.y-(e.row+1)*a,e.extent[2]=e.extent[0]+r,e.extent[3]=e.extent[1]+a}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const i=this.lodAt(t.level);if(null==i)return null;const{resolution:n}=i,s=n*this.size[0],r=n*this.size[1];return e[0]=this.origin.x+t.col*s,e[1]=this.origin.y-(t.row+1)*r,e[2]=e[0]+s,e[3]=e[1]+r,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return n.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const i=[],s=this.lods.length;for(let e=0;e<s;e++){const n=this.lods[e],s=n.resolution*t;i.push(new x.Z({level:n.level,scale:n.scale,resolution:s}))}return new n({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:i})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let i=0;i<e.length;i++){const n=e[i];this._upsampleLevels[n.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/n.resolution:0},t=n}}};var I,_;(0,s._)([(0,l.Cb)({type:Number,json:{write:!0}})],v.prototype,"compressionQuality",void 0),(0,s._)([(0,l.Cb)({type:Number,json:{write:!0}})],v.prototype,"dpi",void 0),(0,s._)([(0,l.Cb)({type:String,json:{read:b.read,write:b.write,origins:{"web-scene":{read:!1,write:!1}}}})],v.prototype,"format",void 0),(0,s._)([(0,l.Cb)({readOnly:!0})],v.prototype,"isWrappable",null),(0,s._)([(0,l.Cb)({type:p.Z,json:{write:!0}})],v.prototype,"origin",void 0),(0,s._)([(0,u.r)("origin")],v.prototype,"readOrigin",null),(0,s._)([(0,l.Cb)({type:[x.Z],value:null,json:{write:!0}})],v.prototype,"lods",null),(0,s._)([(0,l.Cb)({readOnly:!0})],v.prototype,"scales",void 0),(0,s._)([(0,l.Cb)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],v.prototype,"size",void 0),(0,s._)([(0,u.r)("size",["rows","cols"])],v.prototype,"readSize",null),(0,s._)([(0,f.c)("size",{cols:{type:c.z8},rows:{type:c.z8}})],v.prototype,"writeSize",null),(0,s._)([(0,l.Cb)({type:d.Z,json:{write:!0}})],v.prototype,"spatialReference",void 0),v=n=(0,s._)([(0,h.j)("esri.layers.support.TileInfo")],v),I=v||(v={}),(_=I.ExtrapolateOptions||(I.ExtrapolateOptions={}))[_.NONE=0]="NONE",_[_.POWER_OF_TWO=1]="POWER_OF_TWO";const S=v},43077:(e,t,i)=>{i.d(t,{f:()=>n});class n{constructor(e,t,i,n,s=void 0){this.id=e,this.level=t,this.row=i,this.col=n,this.extent=s}}},28589:(e,t,i)=>{i.d(t,{y:()=>S});var n,s=i(43697),r=i(3172),a=i(92036),o=i(91303),l=i(20102),c=i(50758),u=i(13867),h=i(44553),f=i(95330),p=i(17445),d=i(1654),m=i(17452),y=i(5600),g=(i(75215),i(67676)),x=(i(80442),i(52011)),w=i(43077),b=i(22974),v=i(1533);class I{constructor(e){this._validateJSON(e);const{location:t,data:i}=e;this.location=Object.freeze((0,b.d9)(t));const n=this.location.width,s=this.location.height;let r=!0,a=!0;const o=function(e,t=!1){return e<=v.c8?t?new Array(e).fill(0):new Array(e):new Uint32Array(e)}(Math.ceil(n*s/32));let l=0;for(let e=0;e<i.length;e++){const t=e%32;i[e]?(a=!1,o[l]|=1<<t):r=!1,31===t&&++l}a?(this._availability="unavailable",this.byteSize=40):r?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,v.Xw)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;const i=(e-this.location.top)*this.location.width+(t-this.location.left),n=i%32,s=i>>5,r=this._availability;return s<0||s>r.length?"unknown":r[s]&1<<n?"available":"unavailable"}static fromDefinition(e,t){const i=e.service.request||r.Z,{row:n,col:s,width:a,height:o}=e,c={query:{f:"json"}};return t=t?{...c,...t}:c,i(function(e){let t;if(e.service.tileServers?.length){const 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}`;const i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then((e=>e.data)).catch((e=>{if(e&&e.details&&422===e.details.httpStatus)return{location:{top:n,left:s,width:a,height:o},valid:!0,data:(0,g.a9)(a*o,0)};throw e})).then((e=>{if(e.location&&(e.location.top!==n||e.location.left!==s||e.location.width!==a||e.location.height!==o))throw new l.Z("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:n,left:s,width:a,height:o}});return I.fromJSON(e)}))}static fromJSON(e){return Object.freeze(new I(e))}_validateJSON(e){if(!e||!e.location)throw new l.Z("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.Z("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.Z("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.Z("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.Z("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function _(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}let S=n=class extends a.Z{constructor(e){super(e),this._pendingTilemapRequests={},this.request=r.Z,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.z(2*o.Y.MEGABYTES),this.addHandles([(0,p.YP)((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition()),p.nn)])}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}fetchTilemap(e,t,i,n){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.Z("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const s=this._tmpTilemapDefinition,r=this._tilemapFromCache(e,t,i,s);if(r)return Promise.resolve(r);const a=n&&n.signal;return n={...n,signal:null},new Promise(((e,t)=>{(0,f.fu)(a,(()=>t((0,f.zE)())));const i=_(s);let r=this._pendingTilemapRequests[i];if(!r){r=I.fromDefinition(s,n).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=r,r.then(e,e)}r.then(e,t)}))}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";const n=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return n?n.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,n){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(new l.Z("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):this.fetchTilemap(e,t,i,n).catch((e=>e)).then((n=>{if(n instanceof I){const s=n.getAvailability(t,i);if("unavailable"===s)throw new l.Z("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return s}if((0,f.D_)(n))throw n;return"unknown"}))}fetchAvailabilityUpsample(e,t,i,n,s){n.level=e,n.row=t,n.col=i;const r=this.layer.tileInfo;r.updateTileInfo(n);const a=this.fetchAvailability(e,t,i,s).catch((e=>{if((0,f.D_)(e))throw e;if(r.upsampleTile(n))return this.fetchAvailabilityUpsample(n.level,n.row,n.col,n,s);throw e}));return this._fetchAvailabilityUpsamplePrefetch(n.id,e,t,i,s,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,s,r,a){if(!this._prefetchingEnabled||null==e)return;const o=`prefetch-${e}`;if(this.hasHandles(o))return;const l=new AbortController;a.then((()=>l.abort()),(()=>l.abort()));let u=!1;const h=(0,c.kB)((()=>{u||(u=!0,l.abort())}));if(this.addHandles(h,o),await(0,d.MU)(10,l.signal).catch((()=>{})),u||(u=!0,this.removeHandles(o)),(0,f.Hc)(l))return;const p=new w.f(e,t,i,s),m={...r,signal:l.signal},y=this.layer.tileInfo;for(let e=0;n._prefetches.length<n._maxPrefetch&&y.upsampleTile(p);++e){const e=this.fetchAvailability(p.level,p.row,p.col,m);n._prefetches.push(e);const t=()=>{n._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,m.B7)({...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,n){n.level=e,n.row=t-t%this.size,n.col=i-i%this.size;const s=_(n);return this._tilemapCache.get(s)}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,n)=>!!e._tilemapFromCache(t,i,n,e._tmpTilemapDefinition)}}};S._maxPrefetch=4,S._prefetches=new h.Z({initialSize:n._maxPrefetch}),(0,s._)([(0,y.Cb)({constructOnly:!0})],S.prototype,"layer",void 0),(0,s._)([(0,y.Cb)({constructOnly:!0})],S.prototype,"minLOD",void 0),(0,s._)([(0,y.Cb)({constructOnly:!0})],S.prototype,"maxLOD",void 0),(0,s._)([(0,y.Cb)({constructOnly:!0})],S.prototype,"request",void 0),(0,s._)([(0,y.Cb)({constructOnly:!0})],S.prototype,"size",void 0),S=n=(0,s._)([(0,x.j)("esri.layers.support.TilemapCache")],S)},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>r}),i(68773),i(40330);var n=i(22974),s=i(17452);function r(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,s.mN)(e):(0,n.d9)(e)}function o(e,t,i){const n={};for(const s in e){if("declaredClass"===s)continue;const r=e[s];if(null!=r&&"function"!=typeof r)if(Array.isArray(r)){n[s]=[];for(let e=0;e<r.length;e++)n[s][e]=o(r[e])}else if("object"==typeof r)if(r.toJSON){const e=r.toJSON(i&&i[s]);n[s]=t?e:JSON.stringify(e)}else n[s]=t?r:JSON.stringify(r);else n[s]=r}return n}i(71058)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2664],{65845:(e,t,r)=>{r.d(t,{D:()=>n});var a=r(81153);function n(e){e&&e.writtenProperties&&e.writtenProperties.forEach((({target:e,propName:t,newOrigin:r})=>{(0,a.l)(e)&&r&&e.originOf(t)!==r&&e.updateOrigin(t,r)}))}},81153:(e,t,r)=>{function a(e){return e&&"getAtOrigin"in e&&"originOf"in e}r.d(t,{l:()=>a})},32664:(e,t,r)=>{r.d(t,{save:()=>P,saveAs:()=>S});var a=r(67676),n=(r(20102),r(19238)),i=r(64383),o=r(66677),s=r(52104),l=r(84230),u=(r(33516),r(14661));const c="Feature Service",d="feature-layer-utils",y=`${d}-save`,p=`${d}-save-as`;function f(e){return{isValid:(0,l.fP)(e)&&("feature"!==e.type||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function m(e){const t=[],r=[];for(const{layer:a,layerJSON:n}of e)a.isTable?r.push(n):t.push(n);return{layers:t,tables:r}}function w(e){return m([e])}async function v(e,t){return/\/\d+\/?$/.test(e.url)?w(t[0]):async function(e,t){if(!t)return m(e);const{layer:{url:r,customParameters:a,apiKey:i}}=e[0];let o=await t.fetchData("json");o&&null!=o.layers&&null!=o.tables||(o=await async function(e,t,r){e||={},e.layers||=[],e.tables||=[];const{url:a,customParameters:i,apiKey:o}=t,{serviceJSON:l,layersJSON:u}=await(0,s.V)(a,{customParameters:i,apiKey:o}),c=b(e.layers,l.layers,r),d=b(e.tables,l.tables,r);e.layers=c.itemResources,e.tables=d.itemResources;const y=[...c.added,...d.added],p=u?[...u.layers,...u.tables]:[];return await async function(e,t,r,a){const i=t.map((({id:e})=>new n.default({url:r,layerId:e,sourceJSON:a.find((({id:t})=>t===e))})));await Promise.allSettled(i.map((e=>e.load()))),i.forEach((t=>{const{layerId:r,loaded:a,defaultPopupTemplate:n}=t;a&&null!=n&&I(t,{id:r,popupInfo:n.toJSON()},e)}))}(e,y,a,p),e}(o,{url:r??"",customParameters:a,apiKey:i},e.map((e=>e.layer.layerId))));for(const t of e)I(t.layer,t.layerJSON,o);return o}(t,e)}function b(e,t,r){const n=(0,a.e5)(e,t,((e,t)=>e.id===t.id));e=e.filter((e=>!n.removed.some((t=>t.id===e.id))));const i=n.added.map((({id:e})=>({id:e})));return i.forEach((({id:t})=>{e.push({id:t})})),{itemResources:e,added:i.filter((({id:e})=>!r.includes(e)))}}function I(e,t,r){e.isTable?h(r.tables,t):h(r.layers,t)}function h(e,t){const r=e.findIndex((({id:e})=>e===t.id));-1===r?e.push(t):e[r]=t}async function g(e,t){const{url:r,layerId:a,title:n,fullExtent:i,isTable:s}=e,l=(0,o.Qc)(r);t.url="FeatureServer"===l?.serverType?r:`${r}/${a}`,t.title||=n,t.extent=null,s||null==i||(t.extent=await(0,u.$o)(i)),(0,u.ck)(t,u.Kz.METADATA),(0,u.ck)(t,u.Kz.MULTI_LAYER),(0,u.qj)(t,u.Kz.SINGLE_LAYER),s&&(0,u.qj)(t,u.Kz.TABLE)}async function P(e,t){return(0,i.a1)({layer:e,itemType:c,validateLayer:f,createItemData:(e,t)=>v(t,[e]),errorNamePrefix:y},t)}async function S(e,t,r){return(0,i.po)({layer:e,itemType:c,validateLayer:f,createItemData:(e,t)=>Promise.resolve(w(e)),errorNamePrefix:p,newItem:t,setItemProperties:g},r)}},64383:(e,t,r)=>{r.d(t,{a1:()=>w,po:()=>v});var a=r(20102),n=r(65845),i=r(48522),o=r(15235),s=r(33516),l=r(14661);async function u(e){const{layer:t,errorNamePrefix:r,validateLayer:n}=e;await t.load(),function(e,t,r){const n=r(e);if(!n.isValid)throw new a.Z(`${t}:invalid-parameters`,n.errorMessage,{layer:e})}(t,r,n)}function c(e,t){return`Layer (title: ${e.title}, id: ${e.id}) of type '${e.declaredClass}' ${t}`}function d(e,t,r,n){if(e.type!==r)throw new a.Z(`${t}:portal-item-wrong-type`,`Portal item type should be "${r}"`,{item:e,layer:n})}function y(e,t,r){const{portalItem:n}=e;if(!n)throw new a.Z(`${t}:portal-item-not-set`,c(e,"requires the portalItem property to be set"));if(!n.loaded)throw new a.Z(`${t}:portal-item-not-loaded`,c(e,"cannot be saved to a portal item that does not exist or is inaccessible"));d(n,t,r,e)}function p(e,t,r,a){let n=o.default.from(e);return n.id&&(n=n.clone(),n.id=null),n.type??=r,n.portal??=i.Z.getDefault(),d(n,t,r,a),n}async function f(e,t,r){"beforeSave"in e&&"function"==typeof e.beforeSave&&await e.beforeSave();const n=e.write({},t);return function(e,t){let r=(e.messages??[]).filter((({type:e})=>"error"===e)).map((({name:e,message:t,details:r})=>new a.Z(e,t,r)));if(t?.ignoreUnsupported&&(r=r.filter((({name:e})=>"layer:unsupported"!==e&&"symbol:unsupported"!==e&&"symbol-layer:unsupported"!==e&&"property:unsupported"!==e&&"url:unsupported"!==e))),r.length>0)throw new a.Z("layer-write:unsupported","Failed to save layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}(t,r),n}function m(e){(0,l.qj)(e,l.Kz.JSAPI),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}async function w(e,t){const{layer:r,createItemData:a,errorNamePrefix:i,itemType:o}=e;await u(e),y(r,i,o);const l=r.portalItem,c=(0,s.Y)(l),d=await f(r,c,t),p=await a({layer:r,layerJSON:d},l);return m(l),await l.update({data:p}),(0,n.D)(c),l}async function v(e,t){const{layer:r,createItemData:a,setItemProperties:i,newItem:o,errorNamePrefix:l,itemType:c}=e;await u(e);const d=p(o,l,c,r),y=(0,s.Y)(d),w=await f(r,y,t),v=await a({layer:r,layerJSON:w},d);return await i(r,d),m(d),await async function(e,t,r){const a=e.portal;await a.signIn(),await(a.user?.addItem({item:e,data:t,folder:r?.folder}))}(d,v,t),r.portalItem=d,(0,n.D)(y),d}},52104:(e,t,r)=>{r.d(t,{V:()=>n});var a=r(96187);async function n(e,t){const r=await(0,a.T)(e,t);r.layers=r.layers.filter(i);const n={serviceJSON:r};if((r.currentVersion??0)<10.5)return n;const o=await(0,a.T)(e+"/layers",t);return n.layersJSON={layers:o.layers.filter(i),tables:o.tables},n}function i(e){return!e.type||"Feature Layer"===e.type||"Oriented Imagery Layer"===e.type}},33516:(e,t,r)=>{r.d(t,{Y:()=>o,h:()=>i});var a=r(17452),n=r(48522);function i(e){return{origin:"portal-item",url:(0,a.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function o(e){return{origin:"portal-item",messages:[],writtenProperties:[],url:e.itemUrl?(0,a.mN)(e.itemUrl):null,portal:e.portal||n.Z.getDefault(),portalItem:e}}},96187:(e,t,r)=>{r.d(t,{T:()=>n});var a=r(3172);async function n(e,t){const{data:r}=await(0,a.Z)(e,{responseType:"json",query:{f:"json",...t?.customParameters,token:t?.apiKey}});return r}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8008,8062],{71592:(e,a,t)=>{t.d(a,{w:()=>u});var r=t(40330),n=t(3172),i=t(20102),l=t(95330),s=t(66677),c=t(48522),o=t(15235);async function u(e,a){const t=(0,s.Qc)(e);if(!t)throw new i.Z("invalid-url","Invalid scene service url");const u={...a,sceneServerUrl:t.url.path,layerId:t.sublayer??void 0};if(u.sceneLayerItem??=await async function(e){const a=(await y(e)).serviceItemId;if(!a)return null;const t=new o.default({id:a,apiKey:e.apiKey}),i=await async function(e){const a=r.id?.findServerInfo(e.sceneServerUrl);if(a?.owningSystemUrl)return a.owningSystemUrl;const t=e.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const a=(await(0,n.Z)(t,{query:{f:"json"},responseType:"json",signal:e.signal})).data.owningSystemUrl;if(a)return a}catch(e){(0,l.r9)(e)}return null}(e);null!=i&&(t.portal=new c.Z({url:i}));try{return t.load({signal:e.signal})}catch(e){return(0,l.r9)(e),null}}(u),null==u.sceneLayerItem)return d(u.sceneServerUrl.replace("/SceneServer","/FeatureServer"),u);const f=await async function({sceneLayerItem:e,signal:a}){if(!e)return null;try{const t=(await e.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},{signal:a})).find((e=>"Feature Service"===e.type))||null;if(!t)return null;const r=new o.default({portal:t.portal,id:t.id});return await r.load(),r}catch(e){return(0,l.r9)(e),null}}(u);if(!f?.url)throw new i.Z("related-service-not-found","Could not find feature service through portal item relationship");const p=await d(f.url,u);return p.portalItem=f,p}async function y(e){if(e.rootDocument)return e.rootDocument;const a={query:{f:"json",token:e.apiKey},responseType:"json",signal:e.signal};try{const t=await(0,n.Z)(e.sceneServerUrl,a);e.rootDocument=t.data}catch{e.rootDocument={}}return e.rootDocument}async function d(e,a){const t=(0,s.Qc)(e);if(!t)throw new i.Z("invalid-feature-service-url","Invalid feature service url");const r=t.url.path,l=a.layerId;if(null==l)return{serverUrl:r};const c=y(a),o=e=>{const t={query:{f:"json"},responseType:"json",authMode:e,signal:a.signal};return(0,n.Z)(r,t)},u=o("anonymous").catch((()=>o("no-prompt"))),[d,f]=await Promise.all([u,c]),p=f&&f.layers,m=d.data&&d.data.layers;if(!Array.isArray(m))throw new Error("expected layers array");if(Array.isArray(p)){for(let e=0;e<Math.min(p.length,m.length);e++)if(p[e].id===l)return{serverUrl:r,layerId:m[e].id}}else if(null!=l&&l<m.length)return{serverUrl:r,layerId:m[l].id};throw new Error("could not find matching associated sublayer")}},52104:(e,a,t)=>{t.d(a,{V:()=>n});var r=t(96187);async function n(e,a){const t=await(0,r.T)(e,a);t.layers=t.layers.filter(i);const n={serviceJSON:t};if((t.currentVersion??0)<10.5)return n;const l=await(0,r.T)(e+"/layers",a);return n.layersJSON={layers:l.layers.filter(i),tables:l.tables},n}function i(e){return!e.type||"Feature Layer"===e.type||"Oriented Imagery Layer"===e.type}},87344:(e,a,t)=>{t.d(a,{T:()=>r});const r={BingMapsLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(8153)]).then(t.bind(t,2723))).default,BuildingSceneLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(8654),t.e(9238),t.e(6170),t.e(1241),t.e(8217),t.e(3554)]).then(t.bind(t,30223))).default,CSVLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(8654),t.e(9238),t.e(3584)]).then(t.bind(t,45425))).default,DimensionLayer:async()=>(await Promise.all([t.e(163),t.e(9717)]).then(t.bind(t,40081))).default,ElevationLayer:async()=>(await Promise.all([t.e(163),t.e(6569),t.e(9016),t.e(2763)]).then(t.bind(t,65665))).default,FeatureLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(8654),t.e(9238),t.e(7520)]).then(t.bind(t,19238))).default,GeoJSONLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(9069)]).then(t.bind(t,23477))).default,GeoRSSLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(1043)]).then(t.bind(t,3723))).default,GroupLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9059)]).then(t.bind(t,40504))).default,ImageryLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(4165),t.e(4599),t.e(6610),t.e(3663),t.e(4608)]).then(t.bind(t,60590))).default,ImageryTileLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(6610),t.e(4136),t.e(3663),t.e(5913)]).then(t.bind(t,74878))).default,IntegratedMeshLayer:async()=>(await Promise.all([t.e(163),t.e(1241),t.e(1537)]).then(t.bind(t,9310))).default,KMLLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(6472)]).then(t.bind(t,42756))).default,LineOfSightLayer:async()=>(await Promise.all([t.e(163),t.e(4998)]).then(t.bind(t,21786))).default,LinkChartLayer:async()=>(await Promise.all([t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(6404),t.e(8968),t.e(5286),t.e(801)]).then(t.bind(t,19087))).default,MapImageLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(4599),t.e(2863),t.e(7374)]).then(t.bind(t,27374))).default,MapNotesLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(8654),t.e(9238),t.e(2575)]).then(t.bind(t,62128))).default,MediaLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(4828)]).then(t.bind(t,57765))).default,OGCFeatureLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(2341)]).then(t.bind(t,88068))).default,OpenStreetMapLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9971),t.e(6237)]).then(t.bind(t,66237))).default,OrientedImageryLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(8654),t.e(9238),t.e(6964)]).then(t.bind(t,76604))).default,PointCloudLayer:async()=>(await Promise.all([t.e(163),t.e(8775),t.e(8643),t.e(300)]).then(t.bind(t,10608))).default,RouteLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(261)]).then(t.bind(t,40153))).default,SceneLayer:async()=>(await Promise.all([t.e(163),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(6170),t.e(1241),t.e(8217),t.e(1174)]).then(t.bind(t,57476))).default,StreamLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(7132)]).then(t.bind(t,88387))).default,SubtypeGroupLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(8654),t.e(8324),t.e(2596)]).then(t.bind(t,20697))).default,TileLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(1423),t.e(4165),t.e(3778),t.e(4599),t.e(9016),t.e(2863),t.e(8636)]).then(t.bind(t,98636))).default,UnknownLayer:async()=>(await t.e(4166).then(t.bind(t,44166))).default,UnsupportedLayer:async()=>(await t.e(9296).then(t.bind(t,39296))).default,VectorTileLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9016),t.e(4325),t.e(9805),t.e(5481)]).then(t.bind(t,94756))).default,VoxelLayer:async()=>(await Promise.all([t.e(163),t.e(8775),t.e(5464)]).then(t.bind(t,28865))).default,WFSLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(3928),t.e(3547),t.e(6569),t.e(1423),t.e(4165),t.e(3778),t.e(6404),t.e(6506)]).then(t.bind(t,12653))).default,WMSLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9790),t.e(8775),t.e(1574)]).then(t.bind(t,25906))).default,WMTSLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9971),t.e(2594)]).then(t.bind(t,72594))).default,WebTileLayer:async()=>(await Promise.all([t.e(163),t.e(4609),t.e(9971)]).then(t.bind(t,16199))).default}},33516:(e,a,t)=>{t.d(a,{Y:()=>l,h:()=>i});var r=t(17452),n=t(48522);function i(e){return{origin:"portal-item",url:(0,r.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function l(e){return{origin:"portal-item",messages:[],writtenProperties:[],url:e.itemUrl?(0,r.mN)(e.itemUrl):null,portal:e.portal||n.Z.getDefault(),portalItem:e}}},18062:(e,a,t)=>{t.d(a,{$O:()=>b,CD:()=>p,Ld:()=>d,Ok:()=>S,Q4:()=>g,XX:()=>v,_Y:()=>I,load:()=>f});var r=t(20102),n=t(66677),i=t(71592),l=t(52104),s=t(87344),c=t(48522),o=t(33516),u=t(40555),y=t(96187);class d{constructor(){this._serviceMetadatas=new Map}async fetchServiceMetadata(e,a){const t=this._serviceMetadatas.get(e);if(t)return t;const r=await(0,y.T)(e,a);return this._serviceMetadatas.set(e,r),r}}async function f(e,a){const t=e.instance.portalItem;if(t&&t.id)return await t.load(a),function(e){const a=e.instance.portalItem;if(!a?.type||!e.supportedTypes.includes(a.type))throw new r.Z("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:a?.type,expectedType:e.supportedTypes.join(", ")})}(e),async function(e,a){const t=e.instance,n=t.portalItem;if(!n)return;const{url:i,title:s}=n,c=(0,o.h)(n);if("group"===t.type)return t.read({title:s},c),async function(e,a){let t;const{portalItem:n}=e;if(!n)return;const i=n.type,s=a.layerModuleTypeMap;switch(i){case"Feature Service":case"Feature Collection":t=s.FeatureLayer;break;case"Stream Service":t=s.StreamLayer;break;case"Scene Service":t=s.SceneLayer;break;default:throw new r.Z("portal:unsupported-item-type-as-group",`The item type '${i}' is not supported as a 'IGroupLayer'`)}const c=new d;let[o,u]=await Promise.all([t(),L(a,c)]),f=()=>o;if("Feature Service"===i){u=n.url?await b(u,n.url,c):{};const a=v(u),t=I(u),r=[];if(a.length||t?.length){a.length&&r.push("SubtypeGroupLayer"),t?.length&&r.push("OrientedImageryLayer");const e=[];for(const a of r){const t=s[a];e.push(t())}const n=await Promise.all(e),i=new Map;r.forEach(((e,a)=>{i.set(e,n[a])})),f=e=>e.layerType?i.get(e.layerType)??o:o}const i=await async function(e){const{layersJSON:a}=await(0,l.V)(e);if(!a)return null;const t=[...a.layers,...a.tables];return e=>t.find((a=>a.id===e.id))}(n.url);return await w(e,f,u,i)}return"Scene Service"===i&&n.url&&(u=await p(n,u,c)),g(u)>0?await w(e,f,u):await async function(e,a){const{portalItem:t}=e;if(!t?.url)return;const r=await(0,y.T)(t.url);r&&w(e,a,{layers:r.layers?.map(m),tables:r.tables?.map(m)})}(e,f)}(t,e);i&&t.read({url:i},c);const f=new d,h=await L(e,f,a);return h&&t.read(h,c),t.resourceReferences={portalItem:n,paths:c.readResourcePaths??[]},"subtype-group"!==t.type&&t.read({title:s},c),(0,u.y)(t,c)}(e,a)}async function p(e,a,t){if(!e?.url)return a??{};if(a??={},!a.layers){const r=await t.fetchServiceMetadata(e.url);a.layers=r.layers?.map(m)}const{serverUrl:r,portalItem:n}=await(0,i.w)(e.url,{sceneLayerItem:e}).catch((()=>({serverUrl:null,portalItem:null})));if(null==r)return a.tables=[],a;if(!a.tables&&n){const e=await n.fetchData();if(e?.tables)a.tables=e.tables.map(m);else{const e=await t.fetchServiceMetadata(r);a.tables=e?.tables?.map(m)}}if(a.tables)for(const e of a.tables)e.url=`${r}/${e.id}`;return a}function m(e){return{id:e.id,name:e.name}}async function w(e,a,t,r){let n=t.layers||[];const i=t.tables||[];if("Feature Collection"===e.portalItem?.type?(n.forEach(((e,a)=>{e.id=a,"Table"===e?.layerDefinition?.type&&i.push(e)})),n=n.filter((e=>"Table"!==e?.layerDefinition?.type))):(n.reverse(),i.reverse()),n.forEach((n=>{const i=r?.(n);if(i||!r){const r=h(e,a(n),t,n,i);e.add(r)}})),i.length){const a=await s.T.FeatureLayer();i.forEach((n=>{const i=r?.(n);if(i||!r){const r=h(e,a,t,n,i);e.tables.add(r)}}))}}function h(e,a,t,r,n){const i=e.portalItem,l={portalItem:i.clone(),layerId:r.id};null!=r.url&&(l.url=r.url);const s=new a(l);if("sourceJSON"in s&&(s.sourceJSON=n),"subtype-group"!==s.type&&(s.sublayerTitleMode="service-name"),"Feature Collection"===i.type){const e={origin:"portal-item",portal:i.portal||c.Z.getDefault()};s.read(r,e);const a=t.showLegend;null!=a&&s.read({showLegend:a},e)}return s}async function L(e,a,t){if(!1===e.supportsData)return;const r=e.instance,i=r.portalItem;if(!i)return;let l=null;try{l=await i.fetchData("json",t)}catch(e){}if(function(e){return"stream"!==e.type&&"layerId"in e}(r)){let e=null;const t=await async function(e,a,t){if(a?.layers&&a?.tables)return g(a);const r=(0,n.Qc)(e.url);if(!r)return 1;const i=await t.fetchServiceMetadata(r.url.path).catch((()=>null));return(a?.layers?.length??i?.layers?.length??0)+(a?.tables?.length??i?.tables?.length??0)}(i,l,a);if((l?.layers||l?.tables)&&t>0){if(null==r.layerId){const e=v(l);r.layerId="subtype-group"===r.type?e?.[0]:S(l)}e=function(e,a){const{layerId:t}=a,r=e.layers?.find((e=>e.id===t))||e.tables?.find((e=>e.id===t));return r&&function(e,a){return!("feature"===a.type&&"layerType"in e&&"SubtypeGroupLayer"===e.layerType||"subtype-group"===a.type&&!("layerType"in e))}(r,a)?r:null}(l,r),e&&null!=l.showLegend&&(e.showLegend=l.showLegend)}return t>1&&"sublayerTitleMode"in r&&"service-name"!==r.sublayerTitleMode&&(r.sublayerTitleMode="item-title-and-service-name"),e}return l}async function b(e,a,t){if(null==e?.layers||null==e?.tables){const r=await t.fetchServiceMetadata(a);(e=e||{}).layers=e.layers||r?.layers,e.tables=e.tables||r?.tables}return e}function S(e){const a=e.layers;if(a&&a.length)return a[0].id;const t=e.tables;return t&&t.length?t[0].id:null}function g(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function v(e){const a=[];return e?.layers?.forEach((e=>{"SubtypeGroupLayer"===e.layerType&&a.push(e.id)})),a}function I(e){return e?.layers?.filter((({layerType:e})=>"OrientedImageryLayer"===e)).map((({id:e})=>e))}},28008:(e,a,t)=>{t.d(a,{fromItem:()=>u,v:()=>y});var r=t(20102),n=t(71592),i=t(84230),l=t(87344),s=t(15235),c=t(18062),o=t(14661);async function u(e){!e.portalItem||e.portalItem instanceof s.default||(e={...e,portalItem:new s.default(e.portalItem)});const a=await async function(e){await e.load();const a=new c.Ld;return async function(e){const a=e.className,t=l.T[a];return{constructor:await t(),properties:e.properties}}(await y(e,a))}(e.portalItem);return new(0,a.constructor)({portalItem:e.portalItem,...a.properties})}async function y(e,a){switch(e.type){case"Map Service":return async function(e,a){return await async function(e,a){return(await a.fetchServiceMetadata(e.url)).tileInfo}(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}(e,a);case"Feature Service":return async function(e,a){const t=await d(e,a);if("object"==typeof t){const e={};return null!=t.id&&(e.layerId=t.id),{className:t.className||"FeatureLayer",properties:e}}return{className:"GroupLayer"}}(e,a);case"Feature Collection":return async function(e){await e.load();const a=(0,o._$)(e,"Map Notes"),t=(0,o._$)(e,"Markup");if(a||t)return{className:"MapNotesLayer"};if((0,o._$)(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return 1===(0,c.Q4)(r)?{className:"FeatureLayer"}:{className:"GroupLayer"}}(e);case"Scene Service":return async function(e,a){const t=await d(e,a,(async()=>{try{if(!e.url)return[];const{serverUrl:t}=await(0,n.w)(e.url,{sceneLayerItem:e}),r=await a.fetchServiceMetadata(t);return r?.tables??[]}catch{return[]}}));if("object"==typeof t){const r={};let n;if(null!=t.id?(r.layerId=t.id,n=`${e.url}/layers/${t.id}`):n=e.url,e.typeKeywords?.length)for(const a of Object.keys(i.fb))if(e.typeKeywords.includes(a))return{className:i.fb[a]};const l=await a.fetchServiceMetadata(n);return{className:i.fb[l?.layerType]||"SceneLayer",properties:r}}if(!1===t){const t=await a.fetchServiceMetadata(e.url);if("Voxel"===t?.layerType)return{className:"VoxelLayer"}}return{className:"GroupLayer"}}(e,a);case"Image Service":return async function(e,a){await e.load();const t=e.typeKeywords?.map((e=>e.toLowerCase()))??[];if(t.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(t.includes("tiled imagery"))return{className:"ImageryTileLayer"};const r=await e.fetchData(),n=r?.layerType;if("ArcGISTiledImageServiceLayer"===n)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===n)return{className:"ImageryLayer"};const i=await a.fetchServiceMetadata(e.url),l=i.cacheType?.toLowerCase(),s=i.capabilities?.toLowerCase().includes("tilesonly");return"map"===l||s?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}(e,a);case"Stream Service":case"Feed":return{className:"StreamLayer"};case"Vector Tile Service":return{className:"VectorTileLayer"};case"GeoJson":return{className:"GeoJSONLayer"};case"CSV":return{className:"CSVLayer"};case"KML":return{className:"KMLLayer"};case"WFS":return{className:"WFSLayer"};case"WMTS":return{className:"WMTSLayer"};case"WMS":return{className:"WMSLayer"};default:throw new r.Z("portal:unknown-item-type","Unknown item type '${type}'",{type:e.type})}}async function d(e,a,t){const r=e.url;if(!r||/\/\d+$/.test(r))return{};await e.load();let n=await e.fetchData();if("Feature Service"===e.type){const e=f(await(0,c.$O)(n,r,a));if("object"==typeof e){const a=(0,c.XX)(n),t=(0,c._Y)(n);e.className=null!=e.id&&a.includes(e.id)?"SubtypeGroupLayer":null!=e.id&&t?.includes(e.id)?"OrientedImageryLayer":"FeatureLayer"}return e}if("Scene Service"===e.type&&(n=await(0,c.CD)(e,n,a)),(0,c.Q4)(n)>0)return f(n);const i=await a.fetchServiceMetadata(r);return t&&(i.tables=await t()),f(i)}function f(e){return 1===(0,c.Q4)(e)&&{id:(0,c.Ok)(e)}}},40555:(e,a,t)=>{t.d(a,{y:()=>l});var r=t(66643),n=t(95330),i=t(20941);async function l(e,a,t){const l=e&&e.getAtOrigin&&e.getAtOrigin("renderer",a.origin);if(l&&"unique-value"===l.type&&l.styleOrigin){const s=await(0,r.q6)(l.populateFromStyle());if((0,n.k_)(t),!1===s.ok){const t=s.error;a&&a.messages&&a.messages.push(new i.Z("renderer:style-reference",`Failed to create unique value renderer from style reference: ${t.message}`,{error:t,context:a})),e.clear("renderer",a?.origin)}}}},96187:(e,a,t)=>{t.d(a,{T:()=>n});var r=t(3172);async function n(e,a){const{data:t}=await(0,r.Z)(e,{responseType:"json",query:{f:"json",...a?.customParameters,token:a?.apiKey}});return t}}}]);