@arcgis/core 4.30.0-next.20240319 → 4.30.0-next.20240321

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 (119) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{ef19c4fabc3682fc7aa7.js → 0b1ccc2cfb7a6361eae6.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{2d0a01d0957b3e4512f6.js → 2cc832f9f5b10817f300.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{95d7b168991ddb3a96ca.js → 2fe91a15fcdae540babe.js} +1 -1
  5. package/assets/esri/core/workers/chunks/4be6d5660ec1c8ac7606.js +1 -0
  6. package/assets/esri/core/workers/chunks/4f854e0e3a65b768f6be.js +1 -0
  7. package/assets/esri/core/workers/chunks/505f35a02ac6a67a255b.js +1 -0
  8. package/assets/esri/core/workers/chunks/{51fc02ce8cab70b363b1.js → 5162ba2975b4b025590e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/51700be6f50efba0bc82.js +1 -0
  10. package/assets/esri/core/workers/chunks/{766ca6ab0d11ab637278.js → 52274afa07468bc555aa.js} +1 -1
  11. package/assets/esri/core/workers/chunks/5628fa534b2560933230.js +1 -0
  12. package/assets/esri/core/workers/chunks/689a122c77b39e5c73eb.js +1 -0
  13. package/assets/esri/core/workers/chunks/7530fef3ee217643898e.js +1 -0
  14. package/assets/esri/core/workers/chunks/75bd66a0a1b42e057c1a.js +1 -0
  15. package/assets/esri/core/workers/chunks/7819a446d3c9749ff74f.js +1 -0
  16. package/assets/esri/core/workers/chunks/7ca976273f1f64f75aa7.js +1 -0
  17. package/assets/esri/core/workers/chunks/{36d697a3788b86f24588.js → 9403e2ee9c97488ce4f0.js} +1 -1
  18. package/assets/esri/core/workers/chunks/a0de5ad1d08f511cf3d8.js +1 -0
  19. package/assets/esri/core/workers/chunks/b3cd5f8691ba0b5b5729.js +1 -0
  20. package/assets/esri/core/workers/chunks/b3d905c6b100831ad3c4.js +1 -0
  21. package/assets/esri/core/workers/chunks/{50a7742a7e7f7eda5bee.js → df38774f63984be0a478.js} +1 -1
  22. package/assets/esri/core/workers/chunks/e22a13ff683d207e0434.js +1 -0
  23. package/assets/esri/core/workers/chunks/e93cc8cdeaaf81210dc2.js +1 -0
  24. package/assets/esri/core/workers/chunks/{ac8606f2e4719c96a732.js → ee1345b212cde1ff4755.js} +1 -1
  25. package/assets/esri/core/workers/chunks/eecb0064c5343e88bfde.js +1 -0
  26. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  27. package/geometry/support/normalizeUtils.js +1 -1
  28. package/interfaces.d.ts +33 -106
  29. package/layers/SceneLayer.js +1 -1
  30. package/layers/graphics/sources/support/QueryTask.js +1 -1
  31. package/package.json +1 -1
  32. package/rest/geoprocessor/utils.js +1 -1
  33. package/rest/utils.js +1 -1
  34. package/support/revision.js +1 -1
  35. package/views/2d/AnimationManager.js +1 -1
  36. package/views/2d/FrameTask.js +1 -1
  37. package/views/2d/engine/webgl/ClippingInfo.js +1 -1
  38. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  39. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugLayerView.js +1 -1
  40. package/views/2d/input/MapViewInputManager.js +1 -1
  41. package/views/2d/input/handlers/KeyPan.js +1 -1
  42. package/views/2d/input/handlers/KeyRotate.js +1 -1
  43. package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
  44. package/views/2d/layers/BaseLayerView2D.js +1 -1
  45. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  46. package/views/2d/layers/CatalogDynamicGroupLayerView2D.js +1 -1
  47. package/views/2d/layers/CatalogLayerView2D.js +1 -1
  48. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  49. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  50. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  51. package/views/2d/layers/GroupLayerView2D.js +1 -1
  52. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  53. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  54. package/views/2d/layers/KMLLayerView2D.js +1 -1
  55. package/views/2d/layers/KnowledgeGraphLayerView2D.js +1 -1
  56. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  57. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  58. package/views/2d/layers/MediaLayerView2D.js +1 -1
  59. package/views/2d/layers/RouteLayerView2D.js +1 -1
  60. package/views/2d/layers/TileLayerView2D.js +1 -1
  61. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  62. package/views/2d/layers/VideoLayerView2D.js +1 -1
  63. package/views/2d/layers/WMSLayerView2D.js +1 -1
  64. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  65. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  66. package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
  67. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  68. package/views/2d/navigation/MapViewNavigation.js +1 -1
  69. package/views/2d/navigation/ZoomBox.js +1 -1
  70. package/views/2d/navigation/actions/Pan.js +1 -1
  71. package/views/2d/navigation/actions/Pinch.js +1 -1
  72. package/views/2d/support/clippingUtils.js +5 -0
  73. package/views/2d/support/hitTestUtils.js +1 -1
  74. package/views/2d/viewpointUtils.js +1 -1
  75. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  76. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  79. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  80. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  81. package/views/3d/layers/graphics/Labeler.js +1 -1
  82. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  83. package/views/3d/terrain/TerrainRenderer.js +1 -1
  84. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  85. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  86. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  87. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  88. package/views/draw/DrawOperation.js +1 -1
  89. package/views/input/InputManager.js +1 -1
  90. package/views/input/keys.js +1 -1
  91. package/views/interactive/snapping/SnappingManager.js +1 -1
  92. package/widgets/BasemapLayerList.js +1 -1
  93. package/widgets/Editor/workflowUtils.js +1 -1
  94. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  95. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  96. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  97. package/widgets/FeatureTable.js +1 -1
  98. package/widgets/LayerList.js +1 -1
  99. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  100. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  101. package/widgets/OrientedImageryViewer.js +1 -1
  102. package/widgets/Popup.js +1 -1
  103. package/widgets/TableList.js +1 -1
  104. package/assets/esri/core/workers/chunks/13b6de78894ba1a70ace.js +0 -1
  105. package/assets/esri/core/workers/chunks/17a33c1eca0f2908b1a1.js +0 -1
  106. package/assets/esri/core/workers/chunks/187e056c251e69c9b5d2.js +0 -1
  107. package/assets/esri/core/workers/chunks/2427699e34e1895ed024.js +0 -1
  108. package/assets/esri/core/workers/chunks/4e9740f3955a8c45fb2d.js +0 -1
  109. package/assets/esri/core/workers/chunks/5c9e6d1a88fac48baf3a.js +0 -1
  110. package/assets/esri/core/workers/chunks/5f5f6bba98e5671e63a7.js +0 -1
  111. package/assets/esri/core/workers/chunks/7bba67d345da6eced804.js +0 -1
  112. package/assets/esri/core/workers/chunks/92fc6c48ff9f50a7351a.js +0 -1
  113. package/assets/esri/core/workers/chunks/955d7a0c8b2cdabfa8a3.js +0 -1
  114. package/assets/esri/core/workers/chunks/99283ac67e6b73695df7.js +0 -1
  115. package/assets/esri/core/workers/chunks/b9e8c2e2c5b4c9564319.js +0 -1
  116. package/assets/esri/core/workers/chunks/d344e99dd999aaaabbe3.js +0 -1
  117. package/assets/esri/core/workers/chunks/e78e92e024275eccea4e.js +0 -1
  118. package/assets/esri/core/workers/chunks/f7cfdba77cb614fd3725.js +0 -1
  119. package/assets/esri/core/workers/chunks/fc2a12f9e4068ab89628.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[893],{51624:(e,t,s)=>{s.d(t,{A:()=>c});var n,r,i=s(44208),a=s(93687);(r=n||(n={}))[r.varint=0]="varint",r[r.fixed64=1]="fixed64",r[r.delimited=2]="delimited",r[r.fixed32=5]="fixed32",r[r.unknown=99]="unknown";const o=4294967296,u=new TextDecoder("utf-8"),l=(0,i.A)("safari")||(0,i.A)("ios")?6:(0,i.A)("ff")?12:32;class c{constructor(e,t,s=0,r=(e?e.byteLength:0)){this._tag=0,this._dataType=n.unknown,this._init(e,t,s,r)}_init(e,t,s,n){this._data=e,this._dataView=t,this._pos=s,this._end=n}asUnsafe(){return this}clone(){return new c(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(e){this._pos=e}nextTag(e){for(;;){if(this._pos===this._end)return!1;const t=this._decodeVarint();if(this._tag=t>>3,this._dataType=7&t,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;if(e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128)return e;throw new Error("Varint overflow")}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();return e>>>1^-(1&e)}getSInt64(){return this._decodeSVarint()}getBool(){const e=0!==this._data[this._pos];return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,t=this._pos,s=e.getUint32(t,!0)+e.getUint32(t+4,!0)*o;return this._skip(8),s}getSFixed64(){const e=this._dataView,t=this._pos,s=e.getUint32(t,!0)+e.getInt32(t+4,!0)*o;return this._skip(8),s}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),t=this._pos,s=this._toString(this._data,t,t+e);return this._skip(e),s}getBytes(){const e=this._getLength(),t=this._pos,s=this._toBytes(this._data,t,t+e);return this._skip(e),s}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,t,s,n){const r=this.getMessage(),i=e(r,t,s,n);return r.release(),i}processMessage(e){const t=this.getMessage(),s=e(t);return t.release(),s}getMessage(){const e=this._getLength(),t=c.pool.acquire();return t._init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),t}release(){c.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case n.varint:this._decodeVarint();break;case n.fixed64:this._skip(8);break;case n.delimited:this._skip(this._getLength());break;case n.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let t=this._pos,s=0,n=0;if(this._end-t>=10)do{if(n=e[t++],s|=127&n,!(128&n))break;if(n=e[t++],s|=(127&n)<<7,!(128&n))break;if(n=e[t++],s|=(127&n)<<14,!(128&n))break;if(n=e[t++],s|=(127&n)<<21,!(128&n))break;if(n=e[t++],s+=268435456*(127&n),!(128&n))break;if(n=e[t++],s+=34359738368*(127&n),!(128&n))break;if(n=e[t++],s+=4398046511104*(127&n),!(128&n))break;if(n=e[t++],s+=562949953421312*(127&n),!(128&n))break;if(n=e[t++],s+=72057594037927940*(127&n),!(128&n))break;if(n=e[t++],s+=0x8000000000000000*(127&n),!(128&n))break;throw new Error("Varint too long!")}while(0);else{let r=1;for(;t!==this._end&&(n=e[t],128&n);)++t,s+=(127&n)*r,r*=128;if(t===this._end)throw new Error("Varint overrun!");++t,s+=n*r}return this._pos=t,s}_decodeSVarint(){const e=this._data;let t,s=0,n=0;const r=1&e[this._pos];if(n=e[this._pos++],s|=127&n,!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s|=(127&n)<<7,!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s|=(127&n)<<14,!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s|=(127&n)<<21,!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s+=268435456*(127&n),!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s+=34359738368*(127&n),!(128&n))return r?-(s+1)/2:s/2;if(n=e[this._pos++],s+=4398046511104*(127&n),!(128&n))return r?-(s+1)/2:s/2;if(t=BigInt(s),n=e[this._pos++],t+=0x2000000000000n*BigInt(127&n),!(128&n))return Number(r?-(t+1n)/2n:t/2n);if(n=e[this._pos++],t+=0x100000000000000n*BigInt(127&n),!(128&n))return Number(r?-(t+1n)/2n:t/2n);if(n=e[this._pos++],t+=0x8000000000000000n*BigInt(127&n),!(128&n))return Number(r?-(t+1n)/2n:t/2n);throw new Error("Varint too long!")}_getLength(){if(this._dataType!==n.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,t,s){if((s=Math.min(this._end,s))-t>l){const n=e.subarray(t,s);return u.decode(n)}let n="",r="";for(let i=t;i<s;++i){const t=e[i];128&t?r+="%"+t.toString(16):(n+=decodeURIComponent(r)+String.fromCharCode(t),r="")}return r.length&&(n+=decodeURIComponent(r)),n}_toBytes(e,t,s){return s=Math.min(this._end,s),new Uint8Array(e.buffer,t,s-t)}}c.pool=new a.A(c,void 0,(e=>{e._data=null,e._dataView=null}))},17136:(e,t,s)=>{s.d(t,{el:()=>x});var n=s(92602),r=s(49186),i=s(53966),a=s(39829),o=s(82799),u=s(80754),l=s(21325),c=s(28735),p=(s(59456),s(78888)),f=s(65864),h=s(2272),d=s(84952),g=s(92300);const y=()=>i.A.getLogger("esri.geometry.support.normalizeUtils");function m(e){return"polygon"===e[0].type}function _(e){return"polyline"===e[0].type}function k(e,t,s){if(t){const t=function(e,t){if(!(e instanceof o.A||e instanceof a.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y().error(e),new r.A(e)}const s=(0,u.r8)(e),n=[];for(const e of s){const s=[];n.push(s),s.push([e[0][0],e[0][1]]);for(let n=0;n<e.length-1;n++){const r=e[n][0],i=e[n][1],a=e[n+1][0],o=e[n+1][1],u=Math.sqrt((a-r)*(a-r)+(o-i)*(o-i)),l=(o-i)/u,c=(a-r)/u,p=u/t;if(p>1){for(let e=1;e<=p-1;e++){const n=e*t,a=c*n+r,o=l*n+i;s.push([a,o])}const e=(u+Math.floor(p-1)*t)/2,n=c*e+r,a=l*e+i;s.push([n,a])}s.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.A({rings:n,spatialReference:e.spatialReference}):new o.A({paths:n,spatialReference:e.spatialReference})}(e,1e6);e=(0,c.ci)(t,!0)}return s&&(e=(0,u.kS)(e,s)),e}function b(e,t,s){if(Array.isArray(e)){const n=e[0];if(n>t){const s=(0,u.kd)(n,t);e[0]=n+s*(-2*t)}else if(n<s){const t=(0,u.kd)(n,s);e[0]=n+t*(-2*s)}}else{const n=e.x;if(n>t){const s=(0,u.kd)(n,t);e=e.clone().offset(s*(-2*t),0)}else if(n<s){const t=(0,u.kd)(n,s);e=e.clone().offset(t*(-2*s),0)}}return e}function S(e,t){let s=-1;for(let n=0;n<t.cutIndexes.length;n++){const r=t.cutIndexes[n],i=t.geometries[n],a=(0,u.r8)(i);for(let e=0;e<a.length;e++){const t=a[e];t.some((s=>{if(s[0]<180)return!0;{let s=0;for(let e=0;e<t.length;e++){const n=t[e][0];s=n>s?n:s}s=Number(s.toFixed(9));const n=-360*(0,u.kd)(s,180);for(let s=0;s<t.length;s++){const t=i.getPoint(e,s);i.setPoint(e,s,t.clone().offset(n,0))}return!0}}))}if(r===s){if(m(e))for(const t of(0,u.r8)(i))e[r]=e[r].addRing(t);else if(_(e))for(const t of(0,u.r8)(i))e[r]=e[r].addPath(t)}else s=r,e[r]=i}return e}async function x(e,t,s){if(!Array.isArray(e))return x([e],t);t&&"string"!=typeof t&&y().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??n.A.geometryServiceUrl;let i,m,_,w,T,q,I,F,R=0;const A=[],V=[];for(const t of e)if(null!=t)if(i||(i=t.spatialReference,m=(0,l.Vp)(i),_=i.isWebMercator,q=_?102100:4326,w=u.j7[q].maxX,T=u.j7[q].minX,I=u.j7[q].plus180Line,F=u.j7[q].minus180Line),m)if("mesh"===t.type)V.push(t);else if("point"===t.type)V.push(b(t.clone(),w,T));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>b(e,w,T))),V.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,m);V.push(e.rings?new a.A(e):e)}else if(t.extent){const e=t.extent,s=(0,u.kd)(e.xmin,T)*(2*w);let n=0===s?t.clone():(0,u.kS)(t.clone(),s);e.offset(s,0),e.intersects(I)&&e.xmax!==w?(R=e.xmax>R?e.xmax:R,n=k(n,_),A.push(n),V.push("cut")):e.intersects(F)&&e.xmin!==T?(R=e.xmax*(2*w)>R?e.xmax*(2*w):R,n=k(n,_,360),A.push(n),V.push("cut")):V.push(n)}else V.push(t.clone());else V.push(t);else V.push(t);let U=(0,u.kd)(R,w),E=-90;const O=U,G=new o.A;for(;U>0;){const e=360*U-180;G.addPath([[e,E],[e,-1*E]]),E*=-1,U--}if(A.length>0&&O>0){const t=S(A,await async function(e,t,s,n){const r=(0,h.Dl)(e),i=t[0].spatialReference,a={...n,responseType:"json",query:{...r.query,f:"json",sr:(0,l.YX)(i),target:JSON.stringify({geometryType:(0,f.$B)(t[0]),geometries:t}),cutter:JSON.stringify(s)}},o=await(0,p.A)(r.path+"/cut",a),{cutIndexes:u,geometries:c=[]}=o.data;return{cutIndexes:u,geometries:c.map((e=>{const t=(0,f.rS)(e);return t.spatialReference=i,t}))}}(r,A,G,s)),n=[],i=[];for(let s=0;s<V.length;s++){const r=V[s];if("cut"!==r)i.push(r);else{const r=t.shift(),a=e[s];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&r.rings.length>=a.rings.length?(n.push(r),i.push("simplify")):i.push(_?(0,c.Gh)(r):r)}}if(!n.length)return i;const a=await async function(e,t,s){const n="string"==typeof e?(0,d.An)(e):e,r=t[0].spatialReference,i=(0,f.$B)(t[0]),a={...s,query:{...n.query,f:"json",sr:(0,l.YX)(r),geometries:JSON.stringify((0,g.X)(t))}},{data:o}=await(0,p.A)(n.path+"/simplify",a);return(0,g.V)(o.geometries,i,r)}(r,n,s),o=[];for(let e=0;e<i.length;e++){const t=i[e];"simplify"!==t?o.push(t):o.push(_?(0,c.Gh)(a.shift()):a.shift())}return o}const N=[];for(let e=0;e<V.length;e++){const t=V[e];if("cut"!==t)N.push(t);else{const e=A.shift();N.push(!0===_?(0,c.Gh)(e):e)}}return N}},80754:(e,t,s)=>{s.d(t,{j7:()=>a,kS:()=>u,kd:()=>o,r8:()=>l});var n=s(82799),r=s(16930),i=s(65864);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new n.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:r.A.WebMercator}),minus180Line:new n.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:r.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new n.A({paths:[[[180,-180],[180,180]]],spatialReference:r.A.WGS84}),minus180Line:new n.A({paths:[[[-180,-180],[-180,180]]],spatialReference:r.A.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function u(e,t){const s=l(e);for(const e of s)for(const s of e)s[0]+=t;return e}function l(e){return(0,i.Bi)(e)?e.rings:e.paths}},92300:(e,t,s)=>{s.d(t,{V:()=>i,X:()=>r});var n=s(65864);function r(e){return{geometryType:(0,n.$B)(e[0]),geometries:e.map((e=>e.toJSON()))}}function i(e,t,s){const r=(0,n.xD)(t);return e.map((e=>{const t=r.fromJSON(e);return t.spatialReference=s,t}))}},10536:(e,t,s)=>{function n(e){const t={};for(const s in e){if("declaredClass"===s)continue;const r=e[s];if(null!=r&&"function"!=typeof r)if(Array.isArray(r)){t[s]=[];for(let e=0;e<r.length;e++)t[s][e]=n(r[e])}else"object"==typeof r?r.toJSON&&(t[s]=JSON.stringify(r)):t[s]=r}return t}s.d(t,{z:()=>n})},53655:(e,t,s)=>{s.d(t,{SH:()=>R,ae:()=>w,cn:()=>_});var n=s(49186),r=s(51624),i=s(92722),a=s(69418);const o=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],u=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],l=["upperLeft","lowerLeft"];function c(e){return e>=o.length?null:o[e]}function p(e){return e>=u.length?null:u[e]}function f(e){return e>=l.length?null:l[e]}function h(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function d(e,t,s){const n=e.asUnsafe(),r=t.createPointGeometry(s);for(;n.next();)switch(n.tag()){case 3:{const e=n.getUInt32(),s=n.pos()+e;let i=0;for(;n.pos()<s;)t.addCoordinatePoint(r,n.getSInt64(),i++);break}default:n.skip()}return r}function g(e,t,s){const n=e.asUnsafe(),r=t.createGeometry(s),i=2+(s.hasZ?1:0)+(s.hasM?1:0);for(;n.next();)switch(n.tag()){case 2:{const e=n.getUInt32(),s=n.pos()+e;let i=0;for(;n.pos()<s;)t.addLength(r,n.getUInt32(),i++);break}case 3:{const e=n.getUInt32(),s=n.pos()+e;let a=0;for(t.allocateCoordinates(r);n.pos()<s;)t.addCoordinate(r,n.getSInt64(),a),a++,a===i&&(a=0);break}default:n.skip()}return r}function y(e){const t=e.asUnsafe(),s=new i.A;let n="esriGeometryPoint";for(;t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),n=t.pos()+e;for(;t.pos()<n;)s.lengths.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),n=t.pos()+e;for(;t.pos()<n;)s.coords.push(t.getSInt64());break}case 1:n=a.z[t.getEnum()];break;default:t.skip()}return{queryGeometry:s,queryGeometryType:n}}function m(e){const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}function _(e){const t=e.asUnsafe(),s={type:c(0)};for(;t.next();)switch(t.tag()){case 1:s.name=t.getString();break;case 2:s.type=c(t.getEnum());break;case 3:s.alias=t.getString();break;case 4:s.sqlType=p(t.getEnum());break;case 5:default:t.skip();break;case 6:s.defaultValue=t.getString()}return s}function k(e){const t={},s=e.asUnsafe();for(;s.next();)switch(s.tag()){case 1:t.name=s.getString();break;case 2:t.isSystemMaintained=s.getBool();break;default:s.skip()}return t}function b(e,t,s,n){const r=t.createFeature(s);let i=0;for(;e.next();)switch(e.tag()){case 1:{const t=n[i++].name;r.attributes[t]=e.processMessage(m);break}case 2:r.geometry=e.processMessageWithArgs(g,t,s);break;case 4:r.centroid=e.processMessageWithArgs(d,t,s);break;default:e.skip()}return r}function S(e){const t=[1,1,1,1],s=e.asUnsafe();for(;s.next();)switch(s.tag()){case 1:t[0]=s.getDouble();break;case 2:t[1]=s.getDouble();break;case 4:t[2]=s.getDouble();break;case 3:t[3]=s.getDouble();break;default:s.skip()}return t}function x(e){const t=[0,0,0,0],s=e.asUnsafe();for(;s.next();)switch(s.tag()){case 1:t[0]=s.getDouble();break;case 2:t[1]=s.getDouble();break;case 4:t[2]=s.getDouble();break;case 3:t[3]=s.getDouble();break;default:s.skip()}return t}function w(e){const t={originPosition:f(0)},s=e.asUnsafe();for(;s.next();)switch(s.tag()){case 1:t.originPosition=f(s.getEnum());break;case 2:t.scale=s.processMessage(S);break;case 3:t.translate=s.processMessage(x);break;default:s.skip()}return t}function T(e){const t={},s=e.asUnsafe();for(;s.next();)switch(s.tag()){case 1:t.shapeAreaFieldName=s.getString();break;case 2:t.shapeLengthFieldName=s.getString();break;case 3:t.units=s.getString();break;default:s.skip()}return t}function q(e,t){const s=t.createSpatialReference();for(;e.next();)switch(e.tag()){case 1:s.wkid=e.getUInt32();break;case 5:s.wkt=e.getString();break;case 2:s.latestWkid=e.getUInt32();break;case 3:s.vcsWkid=e.getUInt32();break;case 4:s.latestVcsWkid=e.getUInt32();break;default:e.skip()}return s}function I(e,t){const s=t.createFeatureResult(),n=e.asUnsafe();s.geometryType=h(t,0);let r=!1;for(;n.next();)switch(n.tag()){case 1:s.objectIdFieldName=n.getString();break;case 3:s.globalIdFieldName=n.getString();break;case 4:s.geohashFieldName=n.getString();break;case 5:s.geometryProperties=n.processMessage(T);break;case 7:s.geometryType=h(t,n.getEnum());break;case 8:s.spatialReference=n.processMessageWithArgs(q,t);break;case 10:s.hasZ=n.getBool();break;case 11:s.hasM=n.getBool();break;case 12:s.transform=n.processMessage(w);break;case 9:s.exceededTransferLimit=n.getBool();break;case 13:t.addField(s,n.processMessage(_));break;case 15:r||(t.prepareFeatures(s),r=!0),t.addFeature(s,n.processMessageWithArgs(b,t,s,s.fields));break;case 2:s.uniqueIdField=n.processMessage(k);break;default:n.skip()}return t.finishFeatureResult(s),s}function F(e,t){const s={};let n=null;for(;e.next();)switch(e.tag()){case 4:n=e.processMessageWithArgs(y);break;case 1:s.featureResult=e.processMessageWithArgs(I,t);break;default:e.skip()}return null!=n&&s.featureResult&&t.addQueryGeometry(s,n),s}function R(e,t){try{const s=2,n=new r.A(new Uint8Array(e),new DataView(e)),i={};for(;n.next();)n.tag()===s?i.queryResult=n.processMessageWithArgs(F,t):n.skip();return i}catch(e){throw new n.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},69418:(e,t,s)=>{s.d(t,{S:()=>l,z:()=>u});var n=s(83047),r=s(21325),i=s(43334),a=s(58512),o=s(92722);const u=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];class l{constructor(e){this._options=e,this.geometryTypes=u,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new a.A}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!e?.features||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||(0,r.aI)(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const t=(0,n.G9)(this._options.sourceSpatialReference)/(0,n.G9)(e.spatialReference);if(1!==t)for(const s of e.features){if(!(0,i.N3)(s))continue;const e=s.geometry.coords;for(let s=2;s<e.length;s+=3)e[s]*=t}}addFeature(e,t){e.features.push(t)}createFeature(){return new i.Om}createSpatialReference(){return{wkid:0}}createGeometry(){return new o.A}addField(e,t){e.fields.push(t)}allocateCoordinates(e){e.coords.length=e.lengths.reduce(((e,t)=>e+t),0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,t){e.coords[this._coordinatePtr++]=t}addCoordinatePoint(e,t){e.coords.push(t)}addLength(e,t){e.lengths.push(t)}addQueryGeometry(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType}createPointGeometry(){return new o.A}}},66208:(e,t,s)=>{s.d(t,{m:()=>r});var n=s(53655);function r(e,t){const s=(0,n.SH)(e,t),r=s.queryResult.featureResult,i=s.queryResult.queryGeometry,a=s.queryResult.queryGeometryType;if(r&&r.features&&r.features.length&&r.objectIdFieldName){const e=r.objectIdFieldName;for(const t of r.features)t.attributes&&(t.objectId=t.attributes[e])}return r&&(r.queryGeometry=i,r.queryGeometryType=a),r}},80893:(e,t,s)=>{s.d(t,{IJ:()=>d,Jf:()=>_,Pk:()=>y,eW:()=>h,gW:()=>m,kS:()=>g});var n=s(78888),r=s(84952),i=s(65864),a=s(17136),o=s(21325),u=s(10536),l=s(66208),c=s(58501);const p="Layer does not support extent calculation.";function f(e,t){const s=e.geometry,n=e.toJSON();delete n.compactGeometryEnabled,delete n.defaultSpatialReferenceEnabled;const r=n;let a,u,l;if(null!=s&&(u=s.spatialReference,l=(0,o.YX)(u),r.geometryType=(0,i.$B)(s),r.geometry=function(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const s=e.toJSON();return delete s.spatialReference,JSON.stringify(s)}(s,e.compactGeometryEnabled),r.inSR=l),n.groupByFieldsForStatistics&&(r.groupByFieldsForStatistics=n.groupByFieldsForStatistics.join(",")),n.objectIds&&(r.objectIds=n.objectIds.join(",")),n.orderByFields&&(r.orderByFields=n.orderByFields.join(",")),!n.outFields||!n.returnDistinctValues&&(t?.returnCountOnly||t?.returnExtentOnly||t?.returnIdsOnly)?delete r.outFields:n.outFields.includes("*")?r.outFields="*":r.outFields=n.outFields.join(","),n.outSR?(r.outSR=(0,o.YX)(n.outSR),a=e.outSpatialReference):s&&(n.returnGeometry||n.returnCentroid)&&(r.outSR=r.inSR,a=u),n.returnGeometry&&delete n.returnGeometry,n.outStatistics&&(r.outStatistics=JSON.stringify(n.outStatistics)),n.fullText&&(r.fullText=JSON.stringify(n.fullText)),n.pixelSize&&(r.pixelSize=JSON.stringify(n.pixelSize)),n.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&null!=u&&null!=e.quantizationParameters?.extent&&u.equals(e.quantizationParameters.extent.spatialReference)&&delete n.quantizationParameters.extent.spatialReference,r.quantizationParameters=JSON.stringify(n.quantizationParameters)),n.parameterValues&&(r.parameterValues=JSON.stringify(n.parameterValues)),n.rangeValues&&(r.rangeValues=JSON.stringify(n.rangeValues)),n.dynamicDataSource&&(r.layer=JSON.stringify({source:n.dynamicDataSource}),delete n.dynamicDataSource),n.timeExtent){const e=n.timeExtent,{start:t,end:s}=e;null==t&&null==s||(r.time=t===s?t:`${t??"null"},${s??"null"}`),delete n.timeExtent}return e.defaultSpatialReferenceEnabled&&null!=u&&null!=a&&u.equals(a)&&(r.defaultSR=r.inSR,delete r.inSR,delete r.outSR),r}async function h(e,t,s,n){const r=null!=t.timeExtent&&t.timeExtent.isEmpty?{data:{features:[]}}:await k(e,t,"json",n);return(0,c.q)(t,s,r.data),r}async function d(e,t,s,n){if(null!=t.timeExtent&&t.timeExtent.isEmpty)return{data:s.createFeatureResult()};const r=await g(e,t,n),i=r;return i.data=(0,l.m)(r.data,s),i}function g(e,t,s){return k(e,t,"pbf",s)}function y(e,t,s){return null!=t.timeExtent&&t.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):k(e,t,"json",s,{returnIdsOnly:!0})}function m(e,t,s){return null!=t.timeExtent&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):k(e,t,"json",s,{returnIdsOnly:!0,returnCountOnly:!0})}async function _(e,t,s){if(null!=t.timeExtent&&t.timeExtent.isEmpty)return{data:{count:0,extent:null}};const n=await k(e,t,"json",s,{returnExtentOnly:!0,returnCountOnly:!0}),r=n.data;if(r.hasOwnProperty("extent"))return n;if(r.features)throw new Error(p);if(r.hasOwnProperty("count"))throw new Error(p);return n}async function k(e,t,s,i={},o={}){const l="string"==typeof e?(0,r.An)(e):e,c=t.geometry?[t.geometry]:[],p=await(0,a.el)(c,null,{signal:i.signal}),h=p?.[0];null!=h&&((t=t.clone()).geometry=h);const d=(0,u.z)({...l.query,f:s,...o,...f(t,o)});return(0,n.A)((0,r.fj)(l.path,(g=o,null==t.formatOf3DObjects||g.returnCountOnly||g.returnExtentOnly||g.returnIdsOnly?"query":"query3d")),{...i,responseType:"pbf"===s?"array-buffer":"json",query:{...d,...i.query}});var g}},2272:(e,t,s)=>{s.d(t,{Dl:()=>a,jV:()=>i,lF:()=>o}),s(92602),s(70333);var n=s(4718),r=s(84952);function i(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.An)(e):(0,n.o8)(e)}function o(e,t,s){const n={};for(const r in e){if("declaredClass"===r)continue;const i=e[r];if(null!=i&&"function"!=typeof i)if(Array.isArray(i))n[r]=i.map((e=>o({item:e},t,s).item));else if("object"==typeof i)if(i.toJSON){const e=i.toJSON(s?.[r]);n[r]=t?e:JSON.stringify(e)}else n[r]=t?i:JSON.stringify(i);else n[r]=i}return n}s(926)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2186],{2272:(t,e,s)=>{s.d(e,{Dl:()=>o,jV:()=>r,lF:()=>u}),s(92602),s(70333);var n=s(4718),i=s(84952);function r(t,e){return e?{...e,query:{...t??{},...e.query}}:{query:t}}function o(t){return"string"==typeof t?(0,i.An)(t):(0,n.o8)(t)}function u(t,e,s){const n={};for(const i in t){if("declaredClass"===i)continue;const r=t[i];if(null!=r&&"function"!=typeof r)if(Array.isArray(r))n[i]=r.map((t=>u({item:t},e,s).item));else if("object"==typeof r)if(r.toJSON){const t=r.toJSON(s?.[i]);n[i]=e?t:JSON.stringify(t)}else n[i]=e?r:JSON.stringify(r);else n[i]=r}return n}s(926)},32186:(t,e,s)=>{s.r(e),s.d(e,{deleteForwardEdits:()=>o});var n=s(78888),i=s(49186),r=s(2272);async function o(t,e,s,o){if(!e)throw new i.A("post:missing-guid","guid for version is missing");const u=(0,r.Dl)(t),c=s.toJSON(),f=(0,r.jV)(u.query,{query:(0,r.lF)({...c,f:"json"}),...o,method:"post"});e.startsWith("{")&&(e=e.slice(1,-1));const a=`${u.path}/versions/${e}/deleteForwardEdits`,{data:l}=await(0,n.A)(a,f);return l.success}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2209,6591],{70668:(e,t,r)=>{r.d(t,{A:()=>p});var i=r(90237),s=r(69540),n=r(25482),o=r(88930),a=r(10107),l=(r(44208),r(53966),r(87811),r(93223)),d=r(40608),u=r(73133);let c=class extends((0,s.O)(n.oY)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,o.t)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,l.e)(u.j,{nonNullable:!0})],c.prototype,"unit",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{write:!0},nonNullable:!0})],c.prototype,"value",void 0),c=(0,i._)([(0,d.$)("esri.TimeInterval")],c);const p=c},4902:(e,t,r)=>{r.d(t,{PH:()=>a,sA:()=>o});var i=r(90237),s=r(40608);let n=0;const o=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+n++})}};return t=(0,i._)([(0,s.$)("esri.core.Identifiable")],t),t},a=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:n++})}};return t=(0,i._)([(0,s.$)("esri.core.Identifiable.NumericIdentifiable")],t),t};let l=class extends(o(class{})){};l=(0,i._)([(0,s.$)("esri.core.Identifiable")],l)},80200:(e,t,r)=>{r.d(t,{T:()=>i,d:()=>f});const i={Base64:0,Hex:1,String:2,Raw:3},s=8,n=(1<<s)-1;function o(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function a(e){const t=[];for(let r=0,i=e.length*s;r<i;r+=s)t[r>>5]|=(e.charCodeAt(r/s)&n)<<r%32;return t}function l(e){const t=[];for(let r=0,i=32*e.length;r<i;r+=s)t.push(String.fromCharCode(e[r>>5]>>>r%32&n));return t.join("")}function d(e,t,r,i,s,n){return o(function(e,t){return e<<t|e>>>32-t}(o(o(t,e),o(i,n)),s),r)}function u(e,t,r,i,s,n,o){return d(t&r|~t&i,e,t,s,n,o)}function c(e,t,r,i,s,n,o){return d(t&i|r&~i,e,t,s,n,o)}function p(e,t,r,i,s,n,o){return d(t^r^i,e,t,s,n,o)}function y(e,t,r,i,s,n,o){return d(r^(t|~i),e,t,s,n,o)}function h(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let r=1732584193,i=-271733879,s=-1732584194,n=271733878;for(let t=0;t<e.length;t+=16){const a=r,l=i,d=s,h=n;r=u(r,i,s,n,e[t],7,-680876936),n=u(n,r,i,s,e[t+1],12,-389564586),s=u(s,n,r,i,e[t+2],17,606105819),i=u(i,s,n,r,e[t+3],22,-1044525330),r=u(r,i,s,n,e[t+4],7,-176418897),n=u(n,r,i,s,e[t+5],12,1200080426),s=u(s,n,r,i,e[t+6],17,-1473231341),i=u(i,s,n,r,e[t+7],22,-45705983),r=u(r,i,s,n,e[t+8],7,1770035416),n=u(n,r,i,s,e[t+9],12,-1958414417),s=u(s,n,r,i,e[t+10],17,-42063),i=u(i,s,n,r,e[t+11],22,-1990404162),r=u(r,i,s,n,e[t+12],7,1804603682),n=u(n,r,i,s,e[t+13],12,-40341101),s=u(s,n,r,i,e[t+14],17,-1502002290),i=u(i,s,n,r,e[t+15],22,1236535329),r=c(r,i,s,n,e[t+1],5,-165796510),n=c(n,r,i,s,e[t+6],9,-1069501632),s=c(s,n,r,i,e[t+11],14,643717713),i=c(i,s,n,r,e[t],20,-373897302),r=c(r,i,s,n,e[t+5],5,-701558691),n=c(n,r,i,s,e[t+10],9,38016083),s=c(s,n,r,i,e[t+15],14,-660478335),i=c(i,s,n,r,e[t+4],20,-405537848),r=c(r,i,s,n,e[t+9],5,568446438),n=c(n,r,i,s,e[t+14],9,-1019803690),s=c(s,n,r,i,e[t+3],14,-187363961),i=c(i,s,n,r,e[t+8],20,1163531501),r=c(r,i,s,n,e[t+13],5,-1444681467),n=c(n,r,i,s,e[t+2],9,-51403784),s=c(s,n,r,i,e[t+7],14,1735328473),i=c(i,s,n,r,e[t+12],20,-1926607734),r=p(r,i,s,n,e[t+5],4,-378558),n=p(n,r,i,s,e[t+8],11,-2022574463),s=p(s,n,r,i,e[t+11],16,1839030562),i=p(i,s,n,r,e[t+14],23,-35309556),r=p(r,i,s,n,e[t+1],4,-1530992060),n=p(n,r,i,s,e[t+4],11,1272893353),s=p(s,n,r,i,e[t+7],16,-155497632),i=p(i,s,n,r,e[t+10],23,-1094730640),r=p(r,i,s,n,e[t+13],4,681279174),n=p(n,r,i,s,e[t],11,-358537222),s=p(s,n,r,i,e[t+3],16,-722521979),i=p(i,s,n,r,e[t+6],23,76029189),r=p(r,i,s,n,e[t+9],4,-640364487),n=p(n,r,i,s,e[t+12],11,-421815835),s=p(s,n,r,i,e[t+15],16,530742520),i=p(i,s,n,r,e[t+2],23,-995338651),r=y(r,i,s,n,e[t],6,-198630844),n=y(n,r,i,s,e[t+7],10,1126891415),s=y(s,n,r,i,e[t+14],15,-1416354905),i=y(i,s,n,r,e[t+5],21,-57434055),r=y(r,i,s,n,e[t+12],6,1700485571),n=y(n,r,i,s,e[t+3],10,-1894986606),s=y(s,n,r,i,e[t+10],15,-1051523),i=y(i,s,n,r,e[t+1],21,-2054922799),r=y(r,i,s,n,e[t+8],6,1873313359),n=y(n,r,i,s,e[t+15],10,-30611744),s=y(s,n,r,i,e[t+6],15,-1560198380),i=y(i,s,n,r,e[t+13],21,1309151649),r=y(r,i,s,n,e[t+4],6,-145523070),n=y(n,r,i,s,e[t+11],10,-1120210379),s=y(s,n,r,i,e[t+2],15,718787259),i=y(i,s,n,r,e[t+9],21,-343485551),r=o(r,a),i=o(i,l),s=o(s,d),n=o(n,h)}return[r,i,s,n]}function f(e,t=i.Hex){const r=t||i.Base64,n=h(a(e),e.length*s);switch(r){case i.Raw:return n;case i.Hex:return function(e){const t="0123456789abcdef",r=[];for(let i=0,s=4*e.length;i<s;i++)r.push(t.charAt(e[i>>2]>>i%4*8+4&15)+t.charAt(e[i>>2]>>i%4*8&15));return r.join("")}(n);case i.String:return l(n);case i.Base64:return function(e){const t=[];for(let r=0,i=4*e.length;r<i;r+=3){const i=(e[r>>2]>>r%4*8&255)<<16|(e[r+1>>2]>>(r+1)%4*8&255)<<8|e[r+2>>2]>>(r+2)%4*8&255;for(let s=0;s<4;s++)8*r+6*s>32*e.length?t.push("="):t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>6*(3-s)&63))}return t.join("")}(n)}}},87024:(e,t,r)=>{r.d(t,{P:()=>y});var i=r(49186),s=r(80200),n=r(76553),o=r(84952),a=r(13069),l=r(96156),d=r(35666),u=r(10107),c=r(85648),p=r(97159);function y(e){const t=e?.origins??[void 0];return(r,i)=>{const s=function(e,t,r){if("resource"===e?.type)return function(e,t,r){const i=(0,l.z4)(t,r);return{type:String,read:(e,t,r)=>{const s=(0,p.r)(e,t,r);return i.type===String?s:"function"==typeof i.type?new i.type({url:s}):void 0},write:{writer(t,s,a,l){if(!l?.resources)return"string"==typeof t?void(s[a]=(0,p.t)(t,l)):void(s[a]=t.write({},l));const u=function(e){return null==e?null:"string"==typeof e?e:e.url}(t),y=(0,p.t)(u,{...l,verifyItemRelativeUrls:l?.verifyItemRelativeUrls?{writtenUrls:l.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},p.M.NO),g=i.type!==String&&(!(0,n.H)(this)||l?.origin&&this.originIdOf(r)>(0,d.aB)(l.origin)),w={object:this,propertyName:r,value:t,targetUrl:y,dest:s,targetPropertyName:a,context:l,params:e};l?.portalItem&&y&&!(0,o.oP)(y)?g&&e?.contentAddressed?h(w):g?function(e){const{context:t,targetUrl:r,params:i,value:s,dest:n,targetPropertyName:a}=e;if(!t.portalItem)return;const l=t.portalItem.resourceFromPath(r),d=m(s,r,t),u=(0,c.n)(d),p=(0,o.Zo)(l.path),y=i?.compress??!1;u===p?(t.resources&&f({...e,resource:l,content:d,compress:y,updates:t.resources.toUpdate}),n[a]=r):h(e)}(w):function({context:e,targetUrl:t,dest:r,targetPropertyName:i}){e.portalItem&&e.resources&&(e.resources.toKeep.push({resource:e.portalItem.resourceFromPath(t),compress:!1}),r[i]=t)}(w):l?.portalItem&&(null==y||null!=(0,p.i)(y)||(0,o.w8)(y)||g)?h(w):s[a]=y}}}}(e,t,r);switch(e?.type??"other"){case"other":return{read:!0,write:!0};case"url":{const{read:e,write:t}=p.b;return{read:e,write:t}}}}(e,r,i);for(const e of t){const t=(0,u.rM)(r,e,i);for(const e in s)t[e]=s[e]}}}function h(e){const{targetUrl:t,params:r,value:n,context:l,dest:d,targetPropertyName:u}=e;if(!l.portalItem)return;const y=(0,p.p)(t),h=m(n,t,l);if(r?.contentAddressed&&"json"!==h.type)return void l.messages?.push(new i.A("persistable:contentAddressingUnsupported",`Property "${u}" is trying to serializing a resource with content of type ${h.type} with content addressing. Content addressing is only supported for json resources.`,{content:h}));const g=r?.contentAddressed&&"json"===h.type?(0,s.d)(h.jsonString):y?.filename??(0,a.lk)(),w=(0,o.fj)(r?.prefix??y?.prefix,g),v=`${w}.${(0,c.n)(h)}`;if(r?.contentAddressed&&l.resources&&"json"===h.type){const e=l.resources.toKeep.find((({resource:e})=>e.path===v))??l.resources.toAdd.find((({resource:e})=>e.path===v));if(e)return void(d[u]=e.resource.itemRelativeUrl)}const b=l.portalItem.resourceFromPath(v);(0,o.w8)(t)&&l.resources&&l.resources.pendingOperations.push((0,o.tk)(t).then((e=>{b.path=`${w}.${(0,c.n)({type:"blob",blob:e})}`,d[u]=b.itemRelativeUrl})).catch((()=>{})));const I=r?.compress??!1;l.resources&&f({...e,resource:b,content:h,compress:I,updates:l.resources.toAdd}),d[u]=b.itemRelativeUrl}function f({object:e,propertyName:t,updates:r,resource:i,content:s,compress:n}){r.push({resource:i,content:s,compress:n,finish:r=>{!function(e,t,r){"string"==typeof e[t]?e[t]=r.url:e[t].url=r.url}(e,t,r)}})}function m(e,t,r){return"string"==typeof e?{type:"url",url:t}:{type:"json",jsonString:JSON.stringify(e.toJSON(r))}}},76620:(e,t,r)=>{r.d(t,{A:()=>v});var i,s=r(90237),n=r(4576),o=r(66552),a=r(25482),l=r(83047),d=r(67076),u=r(10107),c=(r(44208),r(53966),r(36005)),p=r(40608),y=r(43937);const h=(0,o.O)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),f=h.jsonValues.slice();(0,n.Xy)(f,"orthometric");const m=(0,o.O)()({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.oY{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,r){return h.write(e,t,r)}readHeightModel(e,t,r){return h.read(e)||(r?.messages&&r.messages.push(function(e,t){return new d.A("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:r})),null)}readHeightUnit(e,t,r){return m.read(e)||(r?.messages&&r.messages.push(w(e,{context:r})),null)}readHeightUnitService(e,t,r){return(0,l.LA)(e)||m.read(e)||(r?.messages&&r.messages.push(w(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.k1)(t);return new i({heightModel:e.heightModel,heightUnit:r??void 0,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 w(e,t){return new d.A("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,s._)([(0,u.MZ)({type:h.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:f,default:"ellipsoidal"}}}})],g.prototype,"heightModel",void 0),(0,s._)([(0,y.K)("web-scene","heightModel")],g.prototype,"writeHeightModel",null),(0,s._)([(0,c.w)(["web-scene","service"],"heightModel")],g.prototype,"readHeightModel",null),(0,s._)([(0,u.MZ)({type:m.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:m.jsonValues,write:m.write}}}})],g.prototype,"heightUnit",void 0),(0,s._)([(0,c.w)("web-scene","heightUnit")],g.prototype,"readHeightUnit",null),(0,s._)([(0,c.w)("service","heightUnit")],g.prototype,"readHeightUnitService",null),(0,s._)([(0,u.MZ)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],g.prototype,"vertCRS",void 0),(0,s._)([(0,c.w)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],g.prototype,"readVertCRS",null),g=i=(0,s._)([(0,p.$)("esri.geometry.HeightModelInfo")],g);const v=g},4146:(e,t,r)=>{r.d(t,{A:()=>v});var i=r(90237),s=(r(59456),r(78888)),n=r(49186),o=r(65529),a=r(4902),l=r(92474),d=r(53966),u=r(74887),c=r(84952),p=r(10107),y=(r(44208),r(87811),r(40608)),h=r(92602),f=r(5443),m=r(16930);let g=0,w=class extends(o.A.EventedMixin((0,a.sA)(l.A))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new f.A(-180,-90,180,90,m.A.WGS84),this.id=Date.now().toString(16)+"-layer-"+g++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=m.A.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await r.e(7982).then(r.bind(r,27982))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},{fromItem:i}=await r.e(5613).then(r.bind(r,45613));try{return await i(t)}catch(e){const r=t?.portalItem,i=r?.id||"unset",s=r?.portal?.url||h.A.portalUrl;throw d.A.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+i+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,u.zf)(e)||d.A.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,c.An)(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,s.A)(e,{query:{f:"json"},responseType:"json"})).data;throw new n.A("layer:no-attribution-data","Layer does not have attribution data")}};(0,i._)([(0,p.MZ)({type:String})],w.prototype,"attributionDataUrl",void 0),(0,i._)([(0,p.MZ)({type:f.A})],w.prototype,"fullExtent",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],w.prototype,"hasAttributionData",null),(0,i._)([(0,p.MZ)({type:String,clonable:!1})],w.prototype,"id",void 0),(0,i._)([(0,p.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"legendEnabled",void 0),(0,i._)([(0,p.MZ)({type:["show","hide","hide-children"]})],w.prototype,"listMode",void 0),(0,i._)([(0,p.MZ)({type:Number,range:{min:0,max:1},nonNullable:!0})],w.prototype,"opacity",void 0),(0,i._)([(0,p.MZ)({clonable:!1})],w.prototype,"parent",void 0),(0,i._)([(0,p.MZ)({readOnly:!0})],w.prototype,"parsedUrl",null),(0,i._)([(0,p.MZ)({type:Boolean,readOnly:!0})],w.prototype,"persistenceEnabled",void 0),(0,i._)([(0,p.MZ)({type:Boolean})],w.prototype,"popupEnabled",void 0),(0,i._)([(0,p.MZ)({type:Boolean})],w.prototype,"attributionVisible",void 0),(0,i._)([(0,p.MZ)({type:m.A})],w.prototype,"spatialReference",void 0),(0,i._)([(0,p.MZ)({type:String})],w.prototype,"title",void 0),(0,i._)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],w.prototype,"type",void 0),(0,i._)([(0,p.MZ)()],w.prototype,"url",void 0),(0,i._)([(0,p.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"visible",void 0),w=(0,i._)([(0,y.$)("esri.layers.Layer")],w);const v=w},94568:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Fe});var i=r(90237),s=r(52106),n=r(13874),o=(r(86162),r(94409),r(65345),r(42980),r(39290),r(92438),r(96576),r(93618),r(65494),r(15036)),a=r(78888),l=r(69540),d=r(5503),u=r(49186),c=r(53966),p=r(92071),y=r(74887),h=r(36708),f=r(84952),m=r(10107),g=(r(44208),r(87811),r(88620)),w=r(36005),v=r(40608),b=r(35666),I=r(77738),A=r(86738),_=r(4146),S=r(55726),F=r(52136),M=r(18768),j=r(69208),x=r(47685),L=r(16131),Z=r(8303),O=r(25036),E=r(58947),R=r(4417),T=r(60694),P=r(92009),U=r(4071),D=r(55785),N=r(15426),C=r(40530),q=r(67202),$=r(17036),V=r(95466),G=r(30524),k=r(50805),H=r(20557),Q=r(81457),B=r(39383),J=r(37352),W=r(4513),K=r(25482);let z=class extends K.oY{constructor(){super(...arguments),this.name=null,this.field=null,this.currentRangeExtent=null,this.fullRangeExtent=null,this.type="rangeInfo"}};(0,i._)([(0,m.MZ)({type:String,json:{read:!0,write:!0}})],z.prototype,"name",void 0),(0,i._)([(0,m.MZ)({type:String,json:{read:!0,write:!0}})],z.prototype,"field",void 0),(0,i._)([(0,m.MZ)({type:[Number],json:{read:!0,write:!0}})],z.prototype,"currentRangeExtent",void 0),(0,i._)([(0,m.MZ)({type:[Number],json:{read:!0,write:!0}})],z.prototype,"fullRangeExtent",void 0),(0,i._)([(0,m.MZ)({type:["rangeInfo"],readOnly:!0,json:{read:!1,write:!0}})],z.prototype,"type",void 0),z=(0,i._)([(0,v.$)("esri.layers.support.RangeInfo")],z);var X,Y=r(4718),ee=r(87024),te=r(67076),re=r(39829),ie=r(57251);let se=X=class extends((0,K.Te)(d.A.ofType(re.A))){constructor(e){super(e)}clone(){return new X(this.items.map((e=>e.clone())))}write(e,t){return this.toJSON(t)}toJSON(e){const t=e?.layer?.spatialReference;return t?this.toArray().map((r=>{if(!t.equals(r.spatialReference)){if(!(0,ie.canProjectWithoutEngine)(r.spatialReference,t))return e?.messages&&e.messages.push(new te.A("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),null;const i=new re.A;(0,ie.projectPolygon)(r,i,t),r=i}const i=r.toJSON(e);return delete i.spatialReference,i})).filter((e=>null!=e)):(e?.messages&&e.messages.push(new te.A("scenefilter:unsupported","Writing Scene filters without context layer is not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),this.toArray().map((t=>t.toJSON(e))))}static fromJSON(e,t){const r=new X;return e.forEach((e=>r.add(re.A.fromJSON(e,t)))),r}};se=X=(0,i._)([(0,v.$)("esri.layers.support.PolygonCollection")],se);const ne=se;var oe,ae=r(97159);let le=oe=class extends K.oY{constructor(e){super(e),this.spatialRelationship="disjoint",this.geometries=new ne,this._geometriesSource=null}initialize(){this.addHandles((0,h.on)((()=>this.geometries),"after-changes",(()=>this.geometries=this.geometries),h.OH))}readGeometries(e,t,r){Array.isArray(e)?this.geometries=ne.fromJSON(e,r):this._geometriesSource={url:(0,ae.f)(e,r),context:r}}async loadGeometries(e,t){if(null==this._geometriesSource)return;const{url:r,context:i}=this._geometriesSource,s=await(0,a.A)(r,{responseType:"json",signal:t?.signal}),n=e.toJSON(),o=s.data.map((e=>({...e,spatialReference:n})));this.geometries=ne.fromJSON(o,i),this._geometriesSource=null}clone(){const e=new oe({geometries:(0,Y.o8)(this.geometries),spatialRelationship:this.spatialRelationship});return e._geometriesSource=this._geometriesSource,e}};(0,i._)([(0,m.MZ)({type:["disjoint","contains"],nonNullable:!0,json:{write:!0}})],le.prototype,"spatialRelationship",void 0),(0,i._)([(0,m.MZ)({type:ne,nonNullable:!0,json:{write:!0}}),(0,ee.P)({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],le.prototype,"geometries",void 0),(0,i._)([(0,w.w)(["web-scene","portal-item"],"geometries")],le.prototype,"readGeometries",null),le=oe=(0,i._)([(0,v.$)("esri.layers.support.SceneFilter")],le);const de=le;var ue=r(8947),ce=r(61956),pe=r(24212),ye=r(57465),he=r(30291);async function fe(e){const t=[];for(const r of e)r.name.toLowerCase().endsWith(".zip")?t.push(me(r)):t.push(Promise.resolve(r));return(await Promise.all(t)).flat()}async function me(e){const{BlobReader:t,ZipReader:i,BlobWriter:s}=await Promise.all([r.e(8392),r.e(9588)]).then(r.bind(r,9588)),n=[],o=new i(new t(e));return(await o.getEntries()).forEach((e=>{if(e.directory||/^__MACOS/i.test(e.filename))return;const t=new s,r=e.getData?.(t).then((t=>new File([t],e.filename)));r&&n.push(r)})),Promise.all(n)}var ge=r(28030),we=r(45671),ve=r(78553);const be=new Set(["3DObject","Point"]),Ie=(0,$.p)();let Ae=class extends((0,R.M)((0,x.w6)((0,E.w6)((0,M.b)((0,L.q)((0,Z.A)((0,O.j)((0,p.P)((0,j.d)((0,F.p)((0,l.O)(_.A)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new d.A,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new V.A(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:k.W4.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&(0,N.C$)(this.associatedLayer)}get geometryType(){return Se[this.profile]||"mesh"}set renderer(e){(0,G.yp)(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U.P;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:n,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:l,supportsM:d,isVersioned:u,supportsAttachment:c},operations:{supportsEditing:p,supportsAdd:y,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:w}}=e,v=e.operations.supportsChangeTracking,b=!!this.associatedLayer?.infoFor3D&&(0,ye.Vo)();return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:b&&o,supportsUploadWithItemId:n},data:{supportsAttachment:c,supportsZ:l,supportsM:d,isVersioned:u},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:p&&v,supportsAdd:b&&y&&v,supportsDelete:b&&f&&v,supportsUpdate:h&&v,supportsAsyncConvert3D:w}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&_e[r]?_e[r]:(c.A.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(y.QP),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await(0,ue.L)(this,{origin:"service"},t),(0,G.yp)(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){c.A.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ce.A;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new u.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new u.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=(0,G.hL)(this.fieldsIndex,await(0,we.TO)(this,(0,we.D8)(this)));return(0,ge.s1)(this.parsedUrl.path,this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,t){const r=await this.queryCachedAttributes(e,[t]);if(!r||0===r.length)throw new u.A("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const i=new s.A;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(c.A.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return(0,he.tn)(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new u.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new u.A("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){if(await this.load(t),!this.statisticsInfo)throw new u.A("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new u.A("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const e of this.statisticsInfo)if(e.name===r.name){const r=(0,f.fj)(this.parsedUrl.path,e.href);return(0,a.A)(r,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new u.A("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(E.Xh.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(E.Xh.SAVE,e)}async applyEdits(e,t){const{applyEdits:i}=await r.e(6247).then(r.bind(r,78628));let s=t;await this.load();const n=this.associatedLayer;if(!n)throw new u.A(`${this.type}-layer:not-editable`,"Service is not editable");await n.load();const{globalIdField:o}=n,a=!!n.infoFor3D,l=s?.globalIdUsed??!0;if(a&&null==o)throw new u.A(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(a&&!l)throw new u.A(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return(0,T.Wo)(n.url)&&a&&null!=e.deleteFeatures&&null!=o&&(s={...s,globalIdToObjectId:await(0,N.GA)(n,e.deleteFeatures,o)}),i(this,n.source,e,s)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new u.A(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){const r=e=>{throw c.A.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new u.A("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>(0,H.oF)(this.infoFor3D,t)?e+1:e),0);0===s&&r(new S.VP),s>1&&r(new S.XQ);const n=this.spatialReference,o=t?.location??new A.A({x:0,y:0,z:0,spatialReference:n}),a=o.spatialReference.isGeographic?"local":"georeferenced",l=I.A.createWithExternalSource(o,i,{vertexSpace:a}),[d]=await this.uploadAssets([l],t);return d}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;return t?(await fe(e)).filter((e=>(0,H.fu)(t,e))):e}validateLayer(e){if(e.layerType&&!be.has(e.layerType))throw new u.A("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new u.A("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 u.A("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});!function(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new u.A("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new u.A("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new u.A("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some((t=>t.name===e.name))),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=(0,g.oY)(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),n=this.associatedLayer.originIdOf(i);s<n&&(n===b.Gr.SERVICE||n===b.Gr.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],n)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.editingInfo?.lastEditDate,t=this.associatedLayer?.serverGens,r=this.associatedLayer?.getAtOrigin("fullExtent","service");(0,ye.Vo)()&&null!=this.associatedLayer?.infoFor3D&&r&&(0,T.Wo)(this.associatedLayer?.url)&&e&&this.serviceUpdateTimeStamp?.lastUpdate!==e.getTime()&&(this.serviceUpdateTimeStamp||t?.minServerGen!==t?.serverGen)&&(0,g.oY)(this).setAtOrigin("fullExtent",r.clone(),b.Gr.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await(0,P.L)(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await W.S.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(e){(0,y.zf)(e)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await(0,h.C_)((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?c.A.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):c.A.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&(0,pe.XF)(c.A.getLogger(this),(0,pe.$7)("Mesh scene layers","relative-to-scene",e)),(0,pe.XF)(c.A.getLogger(this),(0,pe.tW)("Scene layers",e))}};(0,i._)([(0,m.MZ)({types:{key:"type",base:C.c,typeMap:{selection:q.A}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Ae.prototype,"featureReduction",void 0),(0,i._)([(0,m.MZ)({type:[z],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Ae.prototype,"rangeInfos",void 0),(0,i._)([(0,m.MZ)({json:{read:!1}})],Ae.prototype,"associatedLayer",void 0),(0,i._)([(0,m.MZ)({type:["show","hide"]})],Ae.prototype,"listMode",void 0),(0,i._)([(0,m.MZ)({type:["ArcGISSceneServiceLayer"]})],Ae.prototype,"operationalLayerType",void 0),(0,i._)([(0,m.MZ)({json:{read:!1},readOnly:!0})],Ae.prototype,"type",void 0),(0,i._)([(0,m.MZ)({...Ie.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Ae.prototype,"fields",void 0),(0,i._)([(0,m.MZ)()],Ae.prototype,"types",null),(0,i._)([(0,m.MZ)()],Ae.prototype,"typeIdField",null),(0,i._)([(0,m.MZ)()],Ae.prototype,"templates",null),(0,i._)([(0,m.MZ)()],Ae.prototype,"formTemplate",null),(0,i._)([(0,m.MZ)({readOnly:!0,clonable:!1})],Ae.prototype,"fieldsIndex",null),(0,i._)([(0,m.MZ)({type:J.A,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Ae.prototype,"floorInfo",void 0),(0,i._)([(0,m.MZ)(Ie.outFields)],Ae.prototype,"outFields",void 0),(0,i._)([(0,m.MZ)({type:k.W4,readOnly:!0,json:{read:!1}})],Ae.prototype,"nodePages",void 0),(0,i._)([(0,w.w)("service","nodePages",["nodePages","pointNodePages"])],Ae.prototype,"readNodePages",null),(0,i._)([(0,m.MZ)({type:[k.uV],readOnly:!0})],Ae.prototype,"materialDefinitions",void 0),(0,i._)([(0,m.MZ)({type:[k.Ot],readOnly:!0})],Ae.prototype,"textureSetDefinitions",void 0),(0,i._)([(0,m.MZ)({type:[k.L0],readOnly:!0})],Ae.prototype,"geometryDefinitions",void 0),(0,i._)([(0,m.MZ)({readOnly:!0})],Ae.prototype,"serviceUpdateTimeStamp",void 0),(0,i._)([(0,m.MZ)({readOnly:!0})],Ae.prototype,"attributeStorageInfo",void 0),(0,i._)([(0,m.MZ)({readOnly:!0})],Ae.prototype,"statisticsInfo",void 0),(0,i._)([(0,m.MZ)({type:d.A.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Ae.prototype,"excludeObjectIds",void 0),(0,i._)([(0,m.MZ)({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Ae.prototype,"definitionExpression",void 0),(0,i._)([(0,m.MZ)({type:de,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Ae.prototype,"filter",void 0),(0,i._)([(0,m.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Ae.prototype,"path",void 0),(0,i._)([(0,m.MZ)(D.Yj)],Ae.prototype,"elevationInfo",null),(0,i._)([(0,m.MZ)({readOnly:!0,json:{read:!1}})],Ae.prototype,"effectiveCapabilities",null),(0,i._)([(0,m.MZ)({readOnly:!0})],Ae.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,m.MZ)({type:String})],Ae.prototype,"geometryType",null),(0,i._)([(0,m.MZ)(D.kF)],Ae.prototype,"labelsVisible",void 0),(0,i._)([(0,m.MZ)({type:[Q.A],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:B.w},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:B.w},write:!0}})],Ae.prototype,"labelingInfo",void 0),(0,i._)([(0,m.MZ)(D.fV)],Ae.prototype,"legendEnabled",void 0),(0,i._)([(0,m.MZ)({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?(0,ve.D)(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Ae.prototype,"opacity",void 0),(0,i._)([(0,m.MZ)({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Ae.prototype,"priority",void 0),(0,i._)([(0,m.MZ)({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Ae.prototype,"semantic",void 0),(0,i._)([(0,m.MZ)({types:o.X,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Ae.prototype,"renderer",null),(0,i._)([(0,m.MZ)({json:{read:!1}})],Ae.prototype,"cachedDrawingInfo",void 0),(0,i._)([(0,w.w)("service","cachedDrawingInfo")],Ae.prototype,"readCachedDrawingInfo",null),(0,i._)([(0,m.MZ)({readOnly:!0,json:{read:!1}})],Ae.prototype,"capabilities",null),(0,i._)([(0,m.MZ)({type:Boolean,json:{read:!1}})],Ae.prototype,"editingEnabled",null),(0,i._)([(0,m.MZ)({readOnly:!0,json:{write:!1,read:!1}})],Ae.prototype,"infoFor3D",null),(0,i._)([(0,m.MZ)({readOnly:!0,json:{write:!1,read:!1}})],Ae.prototype,"relationships",null),(0,i._)([(0,m.MZ)(D.M6)],Ae.prototype,"popupEnabled",void 0),(0,i._)([(0,m.MZ)({type:n.A,json:{name:"popupInfo",write:!0}})],Ae.prototype,"popupTemplate",void 0),(0,i._)([(0,m.MZ)({readOnly:!0,json:{read:!1}})],Ae.prototype,"defaultPopupTemplate",null),(0,i._)([(0,m.MZ)({type:String,json:{read:!1}})],Ae.prototype,"objectIdField",void 0),(0,i._)([(0,w.w)("service","objectIdField",["objectIdField","fields"])],Ae.prototype,"readObjectIdField",null),(0,i._)([(0,m.MZ)({type:String,json:{read:!1}})],Ae.prototype,"globalIdField",void 0),(0,i._)([(0,w.w)("service","globalIdField",["globalIdField","fields"])],Ae.prototype,"readGlobalIdField",null),(0,i._)([(0,m.MZ)({readOnly:!0,type:String,json:{read:!1}})],Ae.prototype,"displayField",null),(0,i._)([(0,m.MZ)({type:String,json:{read:!1}})],Ae.prototype,"profile",void 0),(0,i._)([(0,w.w)("service","profile",["store.profile"])],Ae.prototype,"readProfile",null),(0,i._)([(0,m.MZ)({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Ae.prototype,"normalReferenceFrame",void 0),(0,i._)([(0,m.MZ)(D.PY)],Ae.prototype,"screenSizePerspectiveEnabled",void 0),(0,i._)([(0,m.MZ)({json:{read:!1,origins:{service:{read:!0}}}})],Ae.prototype,"serviceItemId",void 0),Ae=(0,i._)([(0,v.$)("esri.layers.SceneLayer")],Ae);const _e={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Se={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},Fe=Ae},55726:(e,t,r)=>{r.d(t,{$1:()=>d,H2:()=>y,MT:()=>h,VP:()=>f,WF:()=>u,Wt:()=>o,XQ:()=>m,hK:()=>p,nS:()=>c,uh:()=>a,xY:()=>l});var i=r(49186);const s="upload-assets",n=()=>new Error;class o extends i.A{constructor(){super(`${s}:unsupported`,"Layer does not support asset uploads.",n())}}class a extends i.A{constructor(){super(`${s}:no-glb-support`,"Layer does not support glb.",n())}}class l extends i.A{constructor(){super(`${s}:no-supported-source`,"No supported external source found",n())}}class d extends i.A{constructor(){super(`${s}:not-base-64`,"Expected gltf data in base64 format after conversion.",n())}}class u extends i.A{constructor(){super(`${s}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",n())}}class c extends i.A{constructor(e,t){super(`${s}:bad-response`,`Bad response. Uploaded ${e} items and received ${t} results.`,n())}}class p extends i.A{constructor(e,t){super(`${s}-layer:upload-failed`,`Failed to upload mesh file ${e}. Error code: ${t?.code??"-1"}. Error message: ${t?.messages??"unknown"}`,n())}}class y extends i.A{constructor(e){super(`${s}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${e}, but it does not list it in its supported formats.`,n())}}class h extends i.A{constructor(){super(`${s}:convert3D-failed`,"convert3D failed.")}}class f extends i.A{constructor(){super("invalid-input:no-model","No supported model found")}}class m extends i.A{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}}},47685:(e,t,r)=>{r.d(t,{Mk:()=>p,Zk:()=>u,w6:()=>f});var i=r(90237),s=r(65529),n=r(4718),o=r(74887),a=(r(53966),r(44208),r(49186),r(40608)),l=r(20816);const d=new s.A.EventEmitter;function u(e,t,r=null,i=!1){const s=(0,o.Tw)();return i=null==t||i,d.emit("apply-edits",{serviceUrl:e,layerId:t,gdbVersion:r,mayReceiveServiceEdits:i,result:s.promise}),s}const c=Symbol();function p(e){return null!=e&&"object"==typeof e&&c in e}function y(e){return null!=e&&"object"==typeof e&&"gdbVersion"in e}function h(e,t,r){const i=new URL(e).host,s=l.Z3.get(i),n=e=>!e||e===s;return n(t)&&n(r)||t===r}const f=e=>{var t;let r=class extends e{constructor(...e){super(...e),this[t]=!0,this._applyEditsHandler=e=>{const{serviceUrl:t,layerId:r,gdbVersion:i,mayReceiveServiceEdits:s,result:o}=e,a=t===this.url,d=null!=r&&null!=this.layerId&&r===this.layerId,u=y(this),c=y(this)&&h(t,i,this.gdbVersion);if(!a||u&&!c||!d&&!s)return;const p=o.then((e=>{if(d&&(e.addedFeatures.length||e.updatedFeatures.length||e.deletedFeatures.length||e.addedAttachments.length||e.updatedAttachments.length||e.deletedAttachments.length))return this.emit("edits",(0,n.o8)(e)),e;const t=e.editedFeatures?.find((({layerId:e})=>e===this.layerId));if(t){const{adds:r,updates:i,deletes:s}=t.editedFeatures,o={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:r?r.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],deletedFeatures:s?s.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],updatedFeatures:i?i.map((({current:{attributes:e}})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],editedFeatures:(0,n.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,n.o8)(e.historicMoment)};return this.emit("edits",o),o}return{edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:(0,n.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,n.o8)(e.historicMoment)}})).then((e=>("historicMoment"in this&&this.historicMoment!==e.historicMoment&&(0,l.w5)(t,i)&&(this.historicMoment=e.historicMoment),e)));this.emit("apply-edits",{result:p})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:i}=e,s=t===this.url,n=y(this),o=y(this)&&h(t,r,this.gdbVersion),a=y(this)&&!h(t,this.gdbVersion,null);s&&n&&o&&a&&"historicMoment"in this&&this.historicMoment!==i&&(this.historicMoment=i)},this.when().then((()=>{this.addHandles(function(e){return d.on("apply-edits",new WeakRef(e))}(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(function(e){return d.on("update-moment",new WeakRef(e))}(this._updateMomentHandler))}),(()=>{}))}};return t=c,r=(0,i._)([(0,a.$)("esri.layers.mixins.EditBusLayer")],r),r}},25036:(e,t,r)=>{r.d(t,{j:()=>o});var i=r(90237),s=r(10107),n=(r(44208),r(53966),r(87811),r(40608));const o=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,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"minScale",void 0),(0,i._)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"maxScale",void 0),(0,i._)([(0,s.MZ)({readOnly:!0})],t.prototype,"effectiveScaleRange",null),t=(0,i._)([(0,n.$)("esri.layers.mixins.ScaleRangeLayer")],t),t}},40530:(e,t,r)=>{r.d(t,{c:()=>a});var i=r(90237),s=r(25482),n=r(10107),o=(r(44208),r(53966),r(87811),r(40608));let a=class extends s.oY{constructor(){super(...arguments),this.type=null}};(0,i._)([(0,n.MZ)({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],a.prototype,"type",void 0),a=(0,i._)([(0,o.$)("esri.layers.support.FeatureReduction")],a)},67202:(e,t,r)=>{r.d(t,{A:()=>d});var i,s=r(90237),n=r(10107),o=(r(44208),r(53966),r(87811),r(40608)),a=r(40530);let l=i=class extends a.c{constructor(e){super(e),this.type="selection"}clone(){return new i}};(0,s._)([(0,n.MZ)({type:["selection"]})],l.prototype,"type",void 0),l=i=(0,s._)([(0,o.$)("esri.layers.support.FeatureReductionSelection")],l);const d=l},96184:(e,t,r)=>{r.d(t,{A:()=>f});var i=r(90237),s=r(60945),n=r(70668),o=r(69540),a=r(25482),l=r(10107),d=(r(44208),r(53966),r(87811),r(36005)),u=r(40608),c=r(43937),p=r(56400);function y(e,t){return n.A.fromJSON({value:e,unit:t})}let h=class extends((0,o.O)(a.oY)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0}readFullTimeExtent(e,t){if(!t.timeExtent||!Array.isArray(t.timeExtent)||2!==t.timeExtent.length)return null;const r=new Date(t.timeExtent[0]),i=new Date(t.timeExtent[1]);return new s.A({start:r,end:i})}writeFullTimeExtent(e,t){null!=e?.start&&null!=e.end?t.timeExtent=[e.start.getTime(),e.end.getTime()]:t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?y(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?y(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i._)([(0,l.MZ)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],h.prototype,"cumulative",void 0),(0,i._)([(0,l.MZ)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"endField",void 0),(0,i._)([(0,l.MZ)({type:s.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"fullTimeExtent",void 0),(0,i._)([(0,d.w)("fullTimeExtent",["timeExtent"])],h.prototype,"readFullTimeExtent",null),(0,i._)([(0,c.K)("fullTimeExtent")],h.prototype,"writeFullTimeExtent",null),(0,i._)([(0,l.MZ)({type:Boolean,json:{write:!0}})],h.prototype,"hasLiveData",void 0),(0,i._)([(0,l.MZ)({type:n.A,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"interval",void 0),(0,i._)([(0,d.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],h.prototype,"readInterval",null),(0,i._)([(0,c.K)("interval")],h.prototype,"writeInterval",null),(0,i._)([(0,l.MZ)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"startField",void 0),(0,i._)([(0,l.MZ)((0,p.P6)("timeReference",!0))],h.prototype,"timeZone",void 0),(0,i._)([(0,l.MZ)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"trackIdField",void 0),(0,i._)([(0,l.MZ)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],h.prototype,"useTime",void 0),h=(0,i._)([(0,u.$)("esri.layers.support.TimeInfo")],h);const f=h},15426:(e,t,r)=>{r.d(t,{Xl:()=>v,ct:()=>A,C$:()=>C,PD:()=>$,VZ:()=>R,mm:()=>S,VA:()=>N,WP:()=>F,iX:()=>w,GA:()=>G,jp:()=>E,tG:()=>V,lV:()=>M,B5:()=>L,Ye:()=>x,sg:()=>j,hM:()=>Z,S2:()=>O,jD:()=>T,Zm:()=>P,$4:()=>U,bt:()=>I,rn:()=>_});var i=r(70333),s=r(61147),n=r(60999),o=r(49186),a=r(66552),l=r(39516),d=r(90360),u=r(61956);async function c(e,t,r){t=t.clone(),e.capabilities.query.supportsMaxRecordCountFactor&&(t.maxRecordCountFactor=p(e));const i=function(e){return p(e)*function(e){return e.capabilities.query.maxRecordCount||2e3}(e)}(e),s=e.capabilities.query.supportsPagination;t.start=0,t.num=i;let n=null;for(;;){const o=await e.source.queryFeaturesJSON(t,r);if(null==n?n=o:n.features=n.features.concat(o.features),n.exceededTransferLimit=o.exceededTransferLimit,!s||!o.exceededTransferLimit)break;t.start+=i}return n}function p(e){return e.capabilities.query.supportsMaxRecordCountFactor?u.A.MAX_MAX_RECORD_COUNT_FACTOR:1}var y=r(83531),h=r(96576),f=r(93618),m=r(54546),g=r(26591);const w=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function v(e,t,r,i){const s=await D(e);if(await b(e,t,i),!s.addAttachment)throw new o.A(i,"Layer source does not support addAttachment capability");return s.addAttachment(t,r)}function b(e,t,r){const{attributes:i}=t,{objectIdField:s}=e;return e.capabilities?.data?.supportsAttachment?t?i?s&&i[s]?Promise.resolve():Promise.reject(new o.A(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new o.A(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new o.A(r,"A feature is required to add/delete/update attachments")):Promise.reject(new o.A(r,"this layer doesn't support attachments"))}async function I(e,t,r,i,s){const n=await D(e);if(await b(e,t,s),!n.updateAttachment)throw new o.A(s,"Layer source does not support updateAttachment capability");return n.updateAttachment(t,r,i)}async function A(e,t,i){const{applyEdits:s}=await r.e(8628).then(r.bind(r,78628)),n=await e.load(),{source:o,globalIdField:a}=n;let l=i;return("feature"===n.type?n.infoFor3D:null)&&null!=t.deleteFeatures&&null!=a&&(l={...l,globalIdToObjectId:await G(e,t.deleteFeatures,a)}),s(n,o,t,i)}async function _(e,t,i){const{uploadAssets:s}=await r.e(8628).then(r.bind(r,78628)),n=await e.load();return s(n,n.source,t,i)}async function S(e,t,r,i){const s=await D(e);if(await b(e,t,i),!s.deleteAttachments)throw new o.A(i,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(t,r)}async function F(e,t,r){const i=(await e.load({signal:t?.signal})).source;if(!i.fetchRecomputedExtents)throw new o.A(r,"Layer source does not support fetchUpdates capability");return i.fetchRecomputedExtents(t)}async function M(e,t,r,i){t=m.A.from(t),await e.load();const s=e.source,n=e.capabilities;if(!n?.data?.supportsAttachment)throw new o.A(i,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:l,globalIds:d,num:u,size:c,start:p,where:y}=t;if(!n?.operations?.supportsQueryAttachments&&(a?.length>0||d?.length>0||c?.length>0||u||p||y))throw new o.A(i,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t);if(!(l?.length||d?.length||y))throw new o.A(i,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!s.queryAttachments)throw new o.A(i,"Layer source does not support queryAttachments capability",t);return s.queryAttachments(t)}async function j(e,t,r,i){const s=await D(e);if(!s.queryObjectIds)throw new o.A(i,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(u.A.from(t)??e.createQuery(),r)}async function x(e,t,r,i){const s=await D(e);if(!s.queryFeatureCount)throw new o.A(i,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(u.A.from(t)??e.createQuery(),r)}async function L(e,t,r,i){const s=await D(e);if(!s.queryExtent)throw new o.A(i,"Layer source does not support queryExtent capability");return s.queryExtent(u.A.from(t)??e.createQuery(),r)}async function Z(e,t,r,i){const s=await D(e);if(!s.queryRelatedFeatures)throw new o.A(i,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(g.default.from(t),r)}async function O(e,t,r,i){const s=await D(e);if(!s.queryRelatedFeaturesCount)throw new o.A(i,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(g.default.from(t),r)}async function E(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:i}=await t.refresh();if(null!=i&&(e.sourceJSON={...e.sourceJSON,...i},e.read(i,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await(0,l.G)(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function R(e){const t=new u.A,r=e.capabilities?.data,i=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,i&&(t.compactGeometryEnabled=i.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:s,timeExtent:n}=e;return t.timeExtent=null!=s&&null!=n?n.offset(-s.value,s.unit):n||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function T(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const e of r)if("esriFieldTypeGlobalID"===e.type)return e.name}function P(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const e of r)if("esriFieldTypeOID"===e.type)return e.name}function U(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}async function D(e){return(await e.load()).source}async function N(e,t,r){const s=e.parsedUrl?.path;s&&e.authenticationTriggerEvent===t&&await async function(e,t){if(!i.id)return;if(i.id.findCredential(e))return;let r;try{const s=await(0,y.wI)(e,t);s&&(r=await i.id.checkSignInStatus(`${s}/sharing`))}catch(e){}if(r)try{const r=null!=t?t.signal:null;await i.id.getCredential(e,{signal:r})}catch(e){}}(s,r)}function C(e){return!e.sourceJSON?.isMultiServicesView&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const q=(0,d.C)({types:s.xK});function $(e,t){if(e.defaultSymbol)return e.types?.length?new f.A({defaultSymbol:q(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:q(e.symbol,e,t)})))}):new h.A({symbol:q(e.defaultSymbol,e,t)})}function V(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function G(e,t,r){if(null==t)return null;const i=[],{objectIdField:s}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:i}=e;t={globalId:i[r],objectId:null!=i[s]&&-1!==i[s]?i[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||i.push(t.globalId))})),0===i.length)return null;const o=e.createQuery();o.where=i.map((e=>`${r}='${e}'`)).join(" OR "),o.returnGeometry=!1,o.outFields=[s,r],o.cacheHint=!1;const a=await(0,n.DZ)(c(e,o));if(!a.ok)return null;const l=new Map,d=a.value.features;for(const e of d){const t=e.attributes[r],i=e.attributes[s];null!=t&&null!=i&&-1!==i&&l.set(t,i)}return l}},17036:(e,t,r)=>{r.d(t,{p:()=>l});var i=r(44208),s=r(53966),n=r(20437),o=r(95466),a=r(30524);function l(){return{fields:{type:[n.A],value:null,set:function(e){if(e&&(0,i.A)("big-integer-warning-enabled")){const t=e.filter((e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8));if(t.length){const e=t.map((e=>`'${e.name}'`)).join(", ");s.A.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${e}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",e)}},fieldsIndex:{readOnly:!0,get(){return o.A.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const e=this._userOutFields;if(!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||s.A.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e})}return(0,a.DB)(this.fieldsIndex,e)}}}}},20557:(e,t,r)=>{r.d(t,{E1:()=>a,Fm:()=>l,JZ:()=>h,R_:()=>o,fu:()=>s,oF:()=>n,rq:()=>d});const i=[["binary","application/octet-stream","bin",""]];function s(e,t){return null!=c(t.name,e?.supportedFormats??[])}function n(e,t){if(!e)return!1;const r=d(t,e.supportedFormats??[]);return null!=r&&e.editFormats.includes(r)}function o(e,t){return p(function(e,t){const r=e.toLowerCase();return u(t).find((e=>y(e)===r))}(e,t))}function a(e,t){return p(c(e,t))}function l(e,t){return y(function(e,t){return u(t).find((t=>p(t)===e))}(e,t))}function d(e,t){return a(e.name,t)??o(e.type,t)}function u(e){return[...i,...e]}function c(e,t){const r=e.toLowerCase();return u(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>r.endsWith(e)))))}function p(e){return e?.[0]}function y(e){return e?.[1].toLowerCase()}function h(e){return e.tables?.find((e=>"assetMaps"===e.role))}},85648:(e,t,r)=>{r.d(t,{n:()=>s});var i=r(84952);function s(e){return n[function(e){return"json"===e.type?"application/json":"blob"===e.type?e.blob.type:function(e){const t=(0,i.Zo)(e);return l[t]||o}(e.url)}(e)]||a}const n={},o="text/plain",a=n[o],l={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpg",bmp:"image/bmp",gif:"image/gif",json:"application/json",txt:"text/plain",xml:"application/xml",svg:"image/svg+xml",zip:"application/zip",pbf:"application/vnd.mapbox-vector-tile",gz:"application/gzip","bin.gz":"application/octet-stream"};for(const e in l)n[l[e]]=e},73133:(e,t,r)=>{r.d(t,{j:()=>i});const i=(0,r(66552).O)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},8947:(e,t,r)=>{r.d(t,{L:()=>o});var i=r(60999),s=r(74887),n=r(67076);async function o(e,t,r){const o=e&&e.getAtOrigin&&e.getAtOrigin("renderer",t.origin);if(o&&"unique-value"===o.type&&o.styleOrigin){const a=await(0,i.Ke)(o.populateFromStyle());if((0,s.Te)(r),!1===a.ok){const r=a.error;t?.messages&&t.messages.push(new n.A("renderer:style-reference",`Failed to create unique value renderer from style reference: ${r.message}`,{error:r,context:t})),e.clear("renderer",t?.origin)}}}},26591:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var i,s=r(90237),n=(r(59456),r(25482)),o=r(4718),a=r(10107),l=r(56507),d=r(40608),u=r(43937),c=r(27733),p=r(16930);let y=i=class extends n.oY{constructor(e){super(e),this.cacheHint=void 0,this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(e,t){t.historicMoment=e&&e.getTime()}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10,this.start>0&&null==this.where&&(t.definitionExpression="1=1")}clone(){return new i((0,o.o8)({cacheHint:this.cacheHint,dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};(0,s._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],y.prototype,"cacheHint",void 0),(0,s._)([(0,a.MZ)({type:c.L,json:{write:!0}})],y.prototype,"dynamicDataSource",void 0),(0,s._)([(0,a.MZ)({type:String,json:{write:!0}})],y.prototype,"gdbVersion",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{write:!0}})],y.prototype,"geometryPrecision",void 0),(0,s._)([(0,a.MZ)({type:Date})],y.prototype,"historicMoment",void 0),(0,s._)([(0,u.K)("historicMoment")],y.prototype,"_writeHistoricMoment",null),(0,s._)([(0,a.MZ)({type:Number,json:{write:!0}})],y.prototype,"maxAllowableOffset",void 0),(0,s._)([(0,a.MZ)({type:[Number],json:{write:!0}})],y.prototype,"objectIds",void 0),(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],y.prototype,"orderByFields",void 0),(0,s._)([(0,a.MZ)({type:[String],json:{write:!0}})],y.prototype,"outFields",void 0),(0,s._)([(0,a.MZ)({type:p.A,json:{read:{source:"outSR"},write:{target:"outSR"}}})],y.prototype,"outSpatialReference",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],y.prototype,"relationshipId",void 0),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultOffset"}}})],y.prototype,"start",void 0),(0,s._)([(0,u.K)("start"),(0,u.K)("num")],y.prototype,"writeStart",null),(0,s._)([(0,a.MZ)({type:Number,json:{read:{source:"resultRecordCount"}}})],y.prototype,"num",void 0),(0,s._)([(0,a.MZ)({json:{write:!0}})],y.prototype,"returnGeometry",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],y.prototype,"returnM",void 0),(0,s._)([(0,a.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],y.prototype,"returnZ",void 0),(0,s._)([(0,a.MZ)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],y.prototype,"where",void 0),y=i=(0,s._)([(0,d.$)("esri.rest.support.RelationshipQuery")],y),y.from=(0,l.dp)(y);const h=y},20816:(e,t,r)=>{r.d(t,{TA:()=>s,We:()=>a,Z3:()=>n,ZJ:()=>l,w5:()=>d});var i=r(78888);const s=(0,r(13069).vD)(),n=new Map,o=new Map;async function a(e,t,r){if(!e||!r)return!1;if(!t)return!0;const s=new URL(e).host;let o=n.get(s);if(!o){const t=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");o=(await(0,i.A)(t,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}return o===t}async function l(e,t,i=!1){if(!e||!t)return!0;const n=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),a=o.get(n)?.entries();if(a)for(const[e,o]of a)if(o.name===t){const t=!o.stack?.hasForwardEdits();if(!t&&i){const[{deleteForwardEdits:t},{default:i}]=await Promise.all([r.e(2186).then(r.bind(r,32186)),r.e(2558).then(r.bind(r,32558))]);return t(n,e,new i({sessionId:s,moment:o.moment}))}return t}return!0}function d(e,t){if(!e)return!1;const r=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),i=o.get(r)?.entries();if(i)for(const[e,r]of i)if(r.name===t)return"edit"===r.lockType;return!1}new Map}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4244],{71903:(e,t,i)=>{var s;i.d(t,{u:()=>s}),function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(s||(s={}))},32587:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(62788),n=i(95488);class r{constructor(e){this._observable=new n.I,this._map=new Map(e)}get size(){return(0,s.gc)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(e){const t=this._map.delete(e);return t&&this._observable.notify(),t}entries(){return(0,s.gc)(this._observable),this._map.entries()}forEach(e,t){(0,s.gc)(this._observable),this._map.forEach(((i,s)=>e.call(t,i,s,this)),t)}get(e){return(0,s.gc)(this._observable),this._map.get(e)}has(e){return(0,s.gc)(this._observable),this._map.has(e)}keys(){return(0,s.gc)(this._observable),this._map.keys()}set(e,t){return this._map.set(e,t),this._observable.notify(),this}values(){return(0,s.gc)(this._observable),this._map.values()}[Symbol.iterator](){return(0,s.gc)(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}},44794:(e,t,i)=>{i.d(t,{v:()=>o});var s=i(4718),n=i(62788),r=i(95488);class a{constructor(e,t){this._observable=new r.I,this._value=e,this._equalityFunction=t}get value(){return(0,n.gc)(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}}function o(e,t=s.gh){return new a(e,t)}},17136:(e,t,i)=>{i.d(t,{el:()=>b});var s=i(92602),n=i(49186),r=i(53966),a=i(39829),o=i(82799),l=i(80754),c=i(21325),u=i(28735),h=(i(59456),i(78888)),f=i(65864),p=i(2272),d=i(84952),m=i(92300);const g=()=>r.A.getLogger("esri.geometry.support.normalizeUtils");function y(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.A||e instanceof a.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw g().error(e),new n.A(e)}const i=(0,l.r8)(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],r=e[s][1],a=e[s+1][0],o=e[s+1][1],l=Math.sqrt((a-n)*(a-n)+(o-r)*(o-r)),c=(o-r)/l,u=(a-n)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=u*s+n,o=c*s+r;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,s=u*e+n,a=c*e+r;i.push([s,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.A({rings:s,spatialReference:e.spatialReference}):new o.A({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.ci)(t,!0)}return i&&(e=(0,l.kS)(e,i)),e}function v(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=(0,l.kd)(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=(0,l.kd)(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=(0,l.kd)(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=(0,l.kd)(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function _(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],r=t.geometries[s],a=(0,l.r8)(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 s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*(0,l.kd)(i,180);for(let i=0;i<t.length;i++){const t=r.getPoint(e,i);r.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(n===i){if(y(e))for(const t of(0,l.r8)(r))e[n]=e[n].addRing(t);else if(x(e))for(const t of(0,l.r8)(r))e[n]=e[n].addPath(t)}else i=n,e[n]=r}return e}async function b(e,t,i){if(!Array.isArray(e))return b([e],t);t&&"string"!=typeof t&&g().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.A.geometryServiceUrl;let r,y,x,I,S,R,T,A,M=0;const k=[],F=[];for(const t of e)if(null!=t)if(r||(r=t.spatialReference,y=(0,c.Vp)(r),x=r.isWebMercator,R=x?102100:4326,I=l.j7[R].maxX,S=l.j7[R].minX,T=l.j7[R].plus180Line,A=l.j7[R].minus180Line),y)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(v(t.clone(),I,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>v(e,I,S))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,y);F.push(e.rings?new a.A(e):e)}else if(t.extent){const e=t.extent,i=(0,l.kd)(e.xmin,S)*(2*I);let s=0===i?t.clone():(0,l.kS)(t.clone(),i);e.offset(i,0),e.intersects(T)&&e.xmax!==I?(M=e.xmax>M?e.xmax:M,s=w(s,x),k.push(s),F.push("cut")):e.intersects(A)&&e.xmin!==S?(M=e.xmax*(2*I)>M?e.xmax*(2*I):M,s=w(s,x,360),k.push(s),F.push("cut")):F.push(s)}else F.push(t.clone());else F.push(t);else F.push(t);let C=(0,l.kd)(M,I),O=-90;const P=C,z=new o.A;for(;C>0;){const e=360*C-180;z.addPath([[e,O],[e,-1*O]]),O*=-1,C--}if(k.length>0&&P>0){const t=_(k,await async function(e,t,i,s){const n=(0,p.Dl)(e),r=t[0].spatialReference,a={...s,responseType:"json",query:{...n.query,f:"json",sr:(0,c.YX)(r),target:JSON.stringify({geometryType:(0,f.$B)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.A)(n.path+"/cut",a),{cutIndexes:l,geometries:u=[]}=o.data;return{cutIndexes:l,geometries:u.map((e=>{const t=(0,f.rS)(e);return t.spatialReference=r,t}))}}(n,k,z,i)),s=[],r=[];for(let i=0;i<F.length;i++){const n=F[i];if("cut"!==n)r.push(n);else{const n=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&n.rings.length>=a.rings.length?(s.push(n),r.push("simplify")):r.push(x?(0,u.Gh)(n):n)}}if(!s.length)return r;const a=await async function(e,t,i){const s="string"==typeof e?(0,d.An)(e):e,n=t[0].spatialReference,r=(0,f.$B)(t[0]),a={...i,query:{...s.query,f:"json",sr:(0,c.YX)(n),geometries:JSON.stringify((0,m.X)(t))}},{data:o}=await(0,h.A)(s.path+"/simplify",a);return(0,m.V)(o.geometries,r,n)}(n,s,i),o=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?o.push(t):o.push(x?(0,u.Gh)(a.shift()):a.shift())}return o}const D=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)D.push(t);else{const e=k.shift();D.push(!0===x?(0,u.Gh)(e):e)}}return D}},80754:(e,t,i)=>{i.d(t,{j7:()=>a,kS:()=>l,kd:()=>o,r8:()=>c});var s=i(82799),n=i(16930),r=i(65864);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator}),minus180Line:new s.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.A({paths:[[[180,-180],[180,180]]],spatialReference:n.A.WGS84}),minus180Line:new s.A({paths:[[[-180,-180],[-180,180]]],spatialReference:n.A.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.Bi)(e)?e.rings:e.paths}},257:(e,t,i)=>{i.r(t),i.d(t,{default:()=>Mt});var s=i(90237),n=i(13874),r=i(69540),a=i(49186),o=i(53966),l=i(92071),c=i(74887),u=i(36708),h=i(10107),f=i(56507),p=(i(87811),i(44208)),d=i(93223),m=i(40608),g=i(4146),y=i(18768),x=i(63074),w=i(69208),v=(i(59456),i(68729)),_=i(78888),b=i(51447),I=i(36005),S=i(21325),R=i(60694),T=i(55785),A=i(45617),M=i(43577),k=i(22796),F=i(69409),C=i(87045),O=i(39829),P=i(25482),z=i(61893),D=i(91806),N=i(20223),E=i(77301),B=i(70834),L=i(86738);const J=new Map,H=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,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.refCount--,e.refCount<=0&&(s.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.ts=Date.now(),e.refCount++,s.delete(i),s.set(i,e),e.block}return null}putBlock(e,t,i,s){const n=this._cachedBlocks,r=e+"/"+t;if(n.has(r)){const e=n.get(r);e.ts=Date.now(),e.refCount++}else n.set(r,{block:i,ts:Date.now(),refCount:1,controller:s});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,s=e+"/"+t;i.has(s)&&i.delete(s)}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 s=0;s<t.length&&t[s][1].ts<=i-this._duration;s++)e.delete(t[s][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 q(e,t){return null==t?e:`${e}?sliceId=${t}`}function G(e,t,i){const s=J.get(e);if(!s)return null==t?H.decreaseRefCount(e,i):0;if(null==t||null==s[t])return H.decreaseRefCount(e,i);const n=s[t]?.cache,r=n?.get(i);if(n&&r){if(r.refCount--,0===r.refCount){n.delete(i);for(let e=0;e<s.length;e++)s[e]?.cache.delete(i);r.controller&&r.controller.abort()}return r.refCount}return 0}function W(e,t,i){const s=J.get(e);if(!s)return null==t?H.getBlock(e,i):null;if(null==t||null==s[t]){for(let e=0;e<s.length;e++){const t=s[e]?.cache.get(i);if(t)return t.refCount++,t.block}return H.getBlock(e,i)}const n=s[t]?.cache.get(i);if(n)return n.refCount++,n.block;for(let e=0;e<s.length;e++){if(e===t||!s[e])continue;const n=s[e]?.cache,r=n?.get(i);if(n&&r)return r.refCount++,n.set(i,r),r.block}return null}function j(e,t,i,s,n=null){const r=J.get(e);if(!r)return void(null==t&&H.putBlock(e,i,s,n));if(null==t||null==r[t])return void H.putBlock(e,i,s,n);const a={refCount:1,block:s,isResolved:!1,isRejected:!1,controller:n};s.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),r[t]?.cache.set(i,a)}function Z(e,t,i){const s=J.get(e);s?null!=t&&null!=s[t]?s[t]?.cache.delete(i):H.deleteBlock(e,i):null==t&&H.deleteBlock(e,i)}var $=i(16019),U=i(51244),V=i(28435),X=i(14636),Y=i(89738),K=i(5443),Q=i(16930);let ee=0,te=class extends((0,z.g)(P.oY)){constructor(){super(...arguments),this._tileFetchQueue=new Y.e({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,B.Hh)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:C.A.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,B.FT)(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))}get rasterId(){return this.url||"rasterId-"+ee++}set url(e){this._set("url",(0,R.Jf)(e,o.A.getLogger(this)))}async open(e){throw new a.A("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,s={}){const n=s.tileInfo||this.rasterInfo.storageInfo.tileInfo,r=this.getTileExtentFromTileInfo(e,t,i,n);return s={noClip:!0,...s},this.fetchPixels(r,n.size[0],n.size[1],s)}async identify(e,t={}){e=(0,f.PZ)(L.A,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:s}=t,{rasterInfo:n}=this,{hasMultidimensionalTranspose:r,multidimensionalInfo:a}=n;let{transposedVariableName:o}=t;const l=null!=a&&r&&(null!=s||(0,E.DY)(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}=n,{datumTransformation:h}=t;let p=(0,B._I)(e,c,h);if(!u.intersects(p))return{location:p,value:null};if(null!=n.transform){const e=n.transform.inverseTransform(p);if(!n.nativeExtent.intersects(e))return{location:e,value:null};p=e}let d=0;const m=null!=o&&null!=a&&n.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(p,t);const{pixelSize:s}=n,r=3,a=s.x*r/2,o=s.y*r/2,l=new K.A({xmin:p.x-a,xmax:p.x+a,ymin:p.y-o,ymax:p.y+o,spatialReference:c}),u={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:h}=await e.fetchPixels(l,r,r,u),{pixelBlock:f}=await this.fetchPixels(l,r,r,u);if(null==h)return{location:p,value:null};const d=Math.floor(r*r*.5),g=!h.mask||h.mask[d]?h.pixels.map((e=>e[d])):null;let y;return null!=f&&(y=!f.mask||f.mask[d]?f.pixels.map((e=>e[d])):void 0),{location:p,value:g,processedValue:y,pyramidLevel:0}}if(!m)if(t.srcResolution)d=(0,B.t$)(t.srcResolution,n,this.ioConfig.sampling).pyramidLevel;else if(d=await this.computeBestPyramidLevelForLocation(e,t),null==d)return{location:p,value:null};const g=this.identifyPixelLocation(p,d,null,m);if(null===g)return{location:p,value:null};const{row:y,col:x,rowOffset:w,colOffset:v,blockWidth:_}=g,b=o??t.sliceId,I=q(this.rasterId,b),S=`${d}/${y}/${x}`;let R=W(I,null,S);null==R&&(R=this.fetchRawTile(d,y,x,t),j(I,null,S,R));const T=await R;if(!T?.pixels?.length)return{location:p,value:null};const A=w*_+v;return this._processIdentifyResult(T,{srcLocation:p,position:A,pyramidLevel:d,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,s={}){e=(0,B.Ps)(e),s=this._getRequestOptionsWithSliceId(s);const{_hasNoneOrGCSShiftTransform:n}=this;if(s.requestRawData&&n)return this._fetchPixels(e,t,i,s);const r=(0,B.FT)(e.spatialReference),a=(0,B.OM)(e);if(null==r||0===a||1===a&&this._isGlobalWrappableSource&&n)return this._fetchPixels(e,t,i,s);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 n=0;n<=a;n++){const d=new K.A({xmin:0===n?l:-r/2,xmax:n===a?c-r*n:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===n?u-h:n===a?t-f:u;f+=m,p.push(m);const g=s.disableWrapAround&&n>0?null:this._fetchPixels(d,m,i,s);o.push(g)}const d=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const g={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:g,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},s)).pixelBlock:(0,V.z7)(d,g,{blockWidths:p}),{extent:e,srcExtent:(0,B._l)(e,this.rasterInfo.spatialReference,s.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,s={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const n=await this._fetchRawTiles(e,t,i,s),{nativeExtent:r,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new K.A({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(!n)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:p}=n;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:n.pixelBlocks[0]};const d=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,g={x:t.x%d,y:t.y%m};let y;return y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:p,destDimension:i,clipOffset:g,clipSize:i,coefs:null,sampleSpacing:null,interpolation:s.interpolation,alignmentInfo:null,blockWidths:null},s)).pixelBlock:(0,V.z7)(f,p,{clipOffset:g,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:y}}fetchRawTile(e,t,i,s){throw new a.A("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,B._l)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,U.D)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:s}=this.ioConfig,{range:n,query:r,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await(0,_.A)(e,{...t,query:{...r,...s},headers:{...a,...o}})}catch(s){if(i>0)return i--,this.request(e,t,i);throw s}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,E.NG)(e,t)}getTileExtentFromTileInfo(e,t,i,s){const n=s.lodAt(e);return this.getTileExtent({x:n.resolution,y:n.resolution},t,i,s.origin,s.spatialReference,s.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:s}=this.rasterInfo;if(!e.tileInfo){const n=[],r=e.maximumPyramidLevel||0;let a=Math.max(s.x,s.y),o=1/.0254*96*a;for(let e=0;e<=r;e++)n.unshift(new D.A({level:r-e,resolution:a,scale:o})),a*=2,o*=2;const l=new L.A({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new C.A({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,s){const{width:n,height:r,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new L.A({x:a.xmin,y:a.ymax,spatialReference:l});null==s&&(s=Math.max(0,Math.round(Math.log(Math.max(n,r))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],s);e.storageInfo=new N.A({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:s,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,s,n,r=0,a=2){if(1===n.length&&r>0){n=[...n];let{x:e,y:t}=n[0];for(let i=0;i<r;i++)e*=a,t*=a,n.push({x:e,y:t})}const o=[],{x:l,y:c}=s;for(let s=0;s<n.length;s++){const{x:r,y:a}=n[s];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:s}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const n=s**e;return{x:t.x*n,y:t.y*n}}identifyPixelLocation(e,t,i,s){const{spatialReference:n,nativeExtent:r,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=s&&null!=c?c.tileSize[0]:a.blockWidth,h=s&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,B._I)(e,n,i);if(!r.intersects(f))return null;if(t<0||t>o)return null;const p=this.getPyramidPixelSize(t),{x:d,y:m}=p,g=(l.y-f.y)/m/h,y=(f.x-l.x)/d/u,x=Math.min(h-1,Math.floor((g-Math.floor(g))*h)),w=Math.min(u-1,Math.floor((y-Math.floor(y))*u));return{pyramidLevel:t,row:Math.floor(g),col:Math.floor(y),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,s,n,r){const[a,o]=r,l=s.x+i*a*e.x,c=l+a*e.x,u=s.y-t*o*e.y,h=u-o*e.y;return new K.A({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:n})}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 s=this.rasterInfo.storageInfo.blockBoundary[e];return!s||s.maxRow<t||s.maxCol<i||s.minRow>t||s.minCol>i}updateImageSpaceRasterInfo(e){const{extent:t,pixelSize:i}=e;if(-.5===t.xmin&&.5===t.ymax&&1===i.x&&1===i.y&&null==e.transform)return;const{width:s,height:n}=e,r=Q.A.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new K.A({xmin:-.5,ymax:.5,xmax:s-.5,ymin:.5-n,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new L.A({x:1,y:1,spatialReference:r});const{extent:a,storageInfo:o}=e;if(o){o.origin=new L.A({x:a.xmin,y:a.ymax,spatialReference:r});const{tileInfo:t}=o;if(t){t.origin=o.origin;const i=(e.nativePixelSize.x+e.nativePixelSize.y)/2;t.lods.forEach(((e,t)=>{e.resolution=i*2**t,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,s={}){let n=(0,B.OM)(e);if(n>=2)return{extent:e,pixelBlock:null};const r=this._getSourceDataInfo(e,t,i,s),{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,B.FT)(e.spatialReference);!d&&m||(n=(0,B.OM)(r.srcExtent,d));const g=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:n},s);if(!g)return{extent:e,srcExtent:l,pixelBlock:null};const y=f.storageInfo,x=a>0?y.pyramidBlockWidth:y.blockWidth,w=a>0?y.pyramidBlockHeight:y.blockHeight;let{x:v,y:_}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=y;if(null!=e&&e[a-1])({x:v,y:_}=e[a-1]);else{const e=t**a;v*=e,_*=e}}const b=f.spatialReference,I=new L.A({x:v,y:_,spatialReference:b}),S=x===c&&w===u&&h.x%x==0&&h.y%w==0,R=new L.A({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(b),A=b.isGeographic?1e-9:1e-4,{datumTransformation:M}=s;if(!T&&S&&1===g.pixelBlocks.length&&x===t&&w===i&&function(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}(o,R,A))return{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:g.pixelBlocks[0]};const k=m&&null!=(0,B.FT)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,F=s.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");F&&!this.rasterJobHandler&&await(0,B.Hh)();const C=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:R.toJSON(),datumTransformation:M,rasterTransform:p,hasWrapAround:n>0||k,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:F},s):(0,B.l0)({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:R,datumTransformation:M,rasterTransform:p,hasWrapAround:n>0||k,isAdaptive:!1,includeGCSGrid:F});let O;const P=!s.requestRawData,z={rows:C.spacing[0],cols:C.spacing[1]},D=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,g.extent.xmin):void 0,{pixelBlocks:N,mosaicSize:E,isPartiallyFilled:J}=g;let H=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:N,srcMosaicSize:E,destDimension:P?{width:t,height:i}:null,coefs:P?C.coefficients:null,sampleSpacing:P?z:null,projectDirections:F,gcsGrid:F?C.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:s.interpolation,alignmentInfo:D,blockWidths:null},s);({pixelBlock:O,localNorthDirections:H}=e)}else{const e=(0,V.z7)(N,E,{alignmentInfo:D});O=P?(0,V.$i)(e,{width:t,height:i},C.coefficients,z,s.interpolation):e,F&&C.gcsGrid&&(H=(0,V.QF)({width:t,height:i},C.gcsGrid),O=(0,X.Y2)(O,this.rasterInfo.dataType,H))}return s.requestRawData||F?{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:O,transformGrid:C,localNorthDirections:H,isPartiallyFilled:J}:{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:O}}async _fetchRawTiles(e,t,i,s){const{origin:n,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);s.buffer&&(l-=s.buffer.cols,c-=s.buffer.rows,u+=2*s.buffer.cols,h+=2*s.buffer.rows);let d=0,m=0,g=0;f&&null!=p&&(({worldColumnCountFromOrigin:m,originColumnOffset:g,rightPadding:d}=p),m*p.blockWidth-d>=l+u&&(d=0));const y=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+d-1)/a),v=Math.floor((c+h+d-1)/o),_=r[e];if(!_)return null;const{minRow:b,minCol:I,maxCol:S,maxRow:R}=_;if(0===f&&(v<b||w<I||x>R||y>S))return null;const T=new Array;let A=!1;const M=null==this.ioConfig.allowPartialFill?s.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=v;t++)for(let i=y;i<=w;i++){let n=i;if(!s.disableWrapAround&&f&&null!=p&&m<=i&&(n=i-m-g),t>=b&&n>=I&&R>=t&&S>=n){const i=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:s},{signal:s.signal});M?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{A=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const k=await Promise.all(T),F={height:(v-x+1)*o,width:(w-y+1)*a},{spatialReference:C}=this.rasterInfo,O=this.getPyramidPixelSize(e),{x:P,y:z}=O;return{extent:new K.A({xmin:n.x+y*a*P,xmax:n.x+(w+1)*a*P,ymin:n.y-(v+1)*o*z,ymax:n.y-x*o*z,spatialReference:C}),pixelBlocks:k,mosaicSize:F,isPartiallyFilled:A}}_fetchRawTile(e,t,i,s){const n=this.rasterInfo.storageInfo.blockBoundary[e];if(!n)return Promise.resolve(null);const{minRow:r,minCol:a,maxCol:o,maxRow:l}=n;if(t<r||i<a||t>l||i>o)return Promise.resolve(null);const u=q(this.rasterId,s.sliceId),h=`${e}/${t}/${i}`;let f=W(u,s.registryId,h);if(null==f){const n=new AbortController;f=this.fetchRawTile(e,t,i,{...s,signal:n.signal}),j(u,s.registryId,h,f,n),f.catch((()=>Z(u,s.registryId,h)))}return s.signal&&(0,c.u7)(s,(()=>{G(u,s.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 s=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[n,r]=e,a=[],o=[];for(let e=0;e<s;e++){const[t,i]=(0,X.Lu)([n[e],r[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=(0,B.DO)(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,s={}){const n={datumTransformation:s.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};s.srcResolution&&(n.srcResolution=s.srcResolution,this._updateSourceDataInfo(e,n));const r=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=n,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 L.A({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,B.Wo)(a,this.rasterInfo.spatialReference,e,n.datumTransformation);const f=!o||s.srcResolution&&o.x+o.y<s.srcResolution.x+s.srcResolution.y;if(h&&s.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:s.srcResolution.x*t,y:s.srcResolution.y*t}}}o&&(n.srcResolution=o,this._updateSourceDataInfo(e,n))}return this._requireTooManySrcTiles(n.srcWidth,n.srcHeight,t,i)&&(n.srcWidth=0,n.srcHeight=0),n}_requireTooManySrcTiles(e,t,i,s){const{tileInfo:n}=this.rasterInfo.storageInfo,r=e/i,a=t/s;return Math.ceil(e/n.size[0])*Math.ceil(t/n.size[1])>=256*Math.max(1,(i+s)/1024)||r>8||a>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,s=i.spatialReference,{srcResolution:n,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,B.t$)(n,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,B._l)(e,s,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),g=Math.floor((f-c.ymin)/o.y-.1),y=c.width<.1*o.x?0:m-p+1,x=c.height<.1*o.y?0:g-d+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=y,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:s,pyramidLevel:n,useTransposedTile:r}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[s])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!r){const t=e.pixels.map((e=>e[s])),r={location:i,value:t,pyramidLevel:n},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(s*a,s*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,E.QW)(o,h.transposedVariableName);if(u){const e=(0,E.xx)(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,$.Sp)(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 A.A({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:n}}};(0,s._)([(0,h.MZ)()],te.prototype,"_rasterTileAlignmentInfo",void 0),(0,s._)([(0,h.MZ)()],te.prototype,"_tileFetchQueue",void 0),(0,s._)([(0,h.MZ)({readOnly:!0})],te.prototype,"_isGlobalWrappableSource",null),(0,s._)([(0,h.MZ)({readOnly:!0})],te.prototype,"_hasNoneOrGCSShiftTransform",null),(0,s._)([(0,h.MZ)()],te.prototype,"rasterJobHandler",null),(0,s._)([(0,h.MZ)({readOnly:!0})],te.prototype,"rasterId",null),(0,s._)([(0,h.MZ)(T.OZ)],te.prototype,"url",null),(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],te.prototype,"datasetName",void 0),(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],te.prototype,"datasetFormat",void 0),(0,s._)([(0,h.MZ)()],te.prototype,"hasUniqueSourceStorageInfo",void 0),(0,s._)([(0,h.MZ)()],te.prototype,"rasterInfo",void 0),(0,s._)([(0,h.MZ)()],te.prototype,"ioConfig",void 0),(0,s._)([(0,h.MZ)()],te.prototype,"sourceJSON",void 0),te=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.BaseRaster")],te);const ie=te;var se=i(83047),ne=i(14140);async function re(e,t,s){if("extent"===s.type)return function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n;if(i.width/a<.5||i.height/o<.5)return new ne.A({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:p,ymin:d,ymax:m}=i,g=Math.max(l,f),y=Math.min(c,p),x=Math.max(u,d),w=Math.min(h,m),v=.5*a,_=.5*o;if(y-g<v||w-x<_||y<l+v||g>c-v||x>h-_||w<u+_)return new ne.A({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const b=Math.max(0,(g-l)/a),I=Math.min(s,Math.max(0,(y-l)/a)),S=Math.max(0,(h-w)/o),R=Math.min(n,Math.max(0,(h-x)/o)),T=Math.round(b),A=Math.round(I)-1,M=Math.round(S),k=Math.round(R)-1;if(T===A&&b%1>.5&&I%1<.5||M===k&&S%1>.5&&R%1<.5)return new ne.A({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});if(0===T&&0===M&&A===s&&k===n)return e;const F=e.mask;for(let e=M;e<=k;e++)for(let t=T;t<=A;t++){const i=e*s+t;r[i]=F?F[i]:255}return new ne.A({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s);const{width:n,height:r}=e,a=new Uint8Array(n*r),{contains:o,intersects:l}=await Promise.all([i.e(9930),i.e(3209)]).then(i.bind(i,33209));return l(t,s)?"polyline"===s.type?function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n,{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(n-1,m);const g=(f-i)/(p-u);for(let e=d;e<=m;e++){const t=e===d?Math.max(u,p):(n+1-e)*o,c=e===m?Math.min(u,p):t-o;let y=p===u?Math.floor((i-l)/a):Math.floor((g*(t-u)+i-l)/a),x=p===u?Math.floor((f-l)/a):Math.floor((g*(c-u)+i-l)/a);if(x<y){const e=y;y=x,x=e}const w=e*s;y=Math.max(0,y),x=Math.min(s-1,x);for(let e=w+y;e<=w+x;e++)r[e]=h?h[e]:255}}}return new ne.A({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s):o(s,t)?e:function(e,t,i){if(!e)return e;const{width:s,height:n}=e,r=t.width/s,a=t.height/n,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/r,t=(i.xmax-o)/r,s=(l-i.ymax)/a,n=(l-i.ymin)/a;c=[[[e,s],[e,n],[t,n],[t,s],[e,s]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/r,(l-t)/a]))));const u=document.createElement("canvas");u.width=s,u.height=n;const h=u.getContext("2d");h.fillStyle="#f00",h.beginPath(),c.forEach((e=>{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,s,n).data,p=e.mask,d=s*n,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.A({pixelType:e.pixelType,width:s,height:n,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,s):new ne.A({pixelType:e.pixelType,width:n,height:r,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}var ae=i(22671);let oe=class extends ie{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}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:s}=this.primaryRasters,n=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(n);const r=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:r,rasterIds:s});if(t.rawSourceRasterInfos=r,!o.success||0===r.length)throw new a.A("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=ae.A.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=r[0];this.hasUniqueSourceStorageInfo=1===r.length||r.slice(1).every((e=>function(e,t){const{storageInfo:i,pixelSize:s,spatialReference:n,extent:r}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return s.x===o.x&&s.y===o.y&&n.equals(l)&&r.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}(e,c))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,s={}){const{rasters:n,rasterIds:r}=this.primaryRasters;let a=!1;const{interpolation:o}=s,l=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&l&&(a=1===n.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:a});const c=n.map((n=>n.fetchPixels(e,t,i,s))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||s.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((e=>null==e)))return u[0];const p=u.find((e=>null!=e.pixelBlock))?.extent??e;let 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});const{transformGrid:m}=u[0];if(!a||null==d||null==m){const e=s.noClip?null:this.getClippingGeometry(p.spatialReference);return s.noClip||s.requestRawData||null==d||!e||(d=await re(d,p,e)),{...u[0],pixelBlock:d}}const g={rows:m.spacing[0],cols:m.spacing[1]};let y;y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[d],srcMosaicSize:{width:d.width,height:d.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:g,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock:(0,V.$i)(d,{width:t,height:i},m.coefficients,g,o);const x=s.noClip?null:this.getClippingGeometry(e.spatialReference);return s.noClip||s.requestRawData||null==y||null==x||(y=await re(y,e,x)),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:y}}getClippingGeometry(e){const t=this._clippingGeometry.get("0");if(!e||!t)return t;const i=function(e){return String(e.wkid??e.wkt??e.wkt2)}(e);let s=this._clippingGeometry.get(i);return null!=s||(s=e.equals(t.spatialReference)?t:(0,B.uk)(t,e),this._clippingGeometry.set(i,s)),s}async _updateClipGeometry(){const e=this.rasterFunction.getClippingGeometries()[0];let t=e?.clippingGeometry;if(t&&"inside"===e.clippingType){const{extent:e}=this.rasterInfo,{difference:s,densify:n}=await Promise.all([i.e(9930),i.e(3209)]).then(i.bind(i,33209));let r=n(O.A.fromExtent(e),2*(e.width+e.height)/40);r=(0,B.uk)(r,t.spatialReference),t=s(r,t)}this._clippingGeometry.clear(),t&&this._clippingGeometry.set("0",t)}};(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),(0,s._)([(0,h.MZ)()],oe.prototype,"tileType",void 0),(0,s._)([(0,h.MZ)()],oe.prototype,"rasterFunction",void 0),(0,s._)([(0,h.MZ)()],oe.prototype,"primaryRasters",void 0),oe=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.FunctionRaster")],oe);const le=oe;var ce=i(5999),ue=i(6952),he=i(12711),fe=i(85676),pe=i(22048),de=i(4095);const me=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.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.serviceRasterInfo?.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()}get rasterInfo(){return(0,b.Lx)(o.A.getLogger(this),"rasterInfo",{replacement:"serviceRasterInfo",version:"4.29",warnOnce:!0}),this._get("serviceRasterInfo")}set url(e){this._set("url",(0,R.Jf)(e,o.A.getLogger(this)))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer;return(0,v.LF)(s,i)||void 0}async convertVectorFieldData(e,t){const{serviceRasterInfo:i}=this;if(null==e||!i)return null;const s=this._rasterJobHandler.instance,n=i.dataType;return s?s.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,X.FI)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.PZ)(pe.A,e).clone();const{serviceRasterInfo:i}=this,{geometry:s}=e;if(null==s)throw new a.A("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:r}=i;s.spatialReference.equals(r)||(await(0,B.Hh)(),n="extent"===s.type?(0,B._l)(s,r):(0,B.uk)(s,r));const o=e.pixelSize??new L.A({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:r}),{extent:l,width:c,height:u}=function(e,t,i,s=!0){const{spatialReference:n}=e,{x:r,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,se.GA)(e.spatialReference),s=(0,se.GA)(t);if(i===s)return e;const n=i/s;return{x:e.x*n,y:e.y*n}}(i,n);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:g}=e.extent;return s?(h=m+(h>m?r*Math.round((h-m)/r):0),p=g-(p<g?a*Math.round((g-p)/a):0),f=m+(f>m?r*Math.round((f-m)/r):0),d=g-(d<g?a*Math.round((g-d)/a):0),o=new K.A({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:n}),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=g-(p<g?a*Math.floor((g-p)/a+.1):0),f=h+l*r,d=p-c*a,o=new K.A({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:n})),{extent:o,width:l,height:c}}(i,n,o),h=await this.fetchPixels(l,c,u,{...t,interpolation:"nearest"});if(null==h.pixelBlock)throw new a.A("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const p=await re(h.pixelBlock,l,n),d=this._rasterJobHandler.instance;return d?d.computeStatisticsHistograms({pixelBlock:p},t):(0,ue.eH)(p)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,de.CW)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;i?.length||(i=(0,E.fy)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const s=e.timeExtent||this.timeExtent;if(null!=i&&null!=s&&(null!=s.start||null!=s.end)){i=i.map((e=>e.clone()));const n=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),r=i.find((({dimensionName:e})=>"StdTime"===e));if(!n||!r)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=s,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=n.values){const e=n.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,s=Array.isArray(e)?e[1]:e,n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:t;return u===h?i-n:Math.abs(s-h)-Math.abs(r-h)}))[0];r.values=[t]}else i=null}else if(n.hasRegularIntervals&&n.extent){const[e,t]=n.extent;u>t||h<e?i=null:r.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,E.sx)(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",k.A.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:s}=this;if(s){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const n=(0,ce.vt)(s.functionDefinition?.toJSON()??s.toJSON(),i),r=new le({rasterFunction:n});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&&!s)return;const{bandIds:n}=this,{bandCount:r}=this.raster.rasterInfo,a=n?.length?n.some((e=>e>=r)):r>=3;n&&(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,s=(0,E.ct)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,r=(0,he.$P)({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(r))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,he.m7)(i,n),t.rendererJSON=r,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=r)}async applyRenderer(e,t){const i=e?.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let s;await this.updateRenderer();const n=this._rasterJobHandler.instance,r=this.bandIds??[];return s=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:r}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:r}),s}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 s=(0,S.Vp)(e);return C.A.create({size:256,spatialReference:e,origin:s?{x:s.origin[0],y:s.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,s,n={}){if(i(this),n.requestAsImageElement){const i=this.getTileUrl(e,t,s);return(0,_.A)(i,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then((e=>e.data))}const{serviceRasterInfo:r}=this;if(null!=r.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition){const i=n.tileInfo||r.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,s,i),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,s,n)}async fetchPixels(e,t,i,s={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).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,s))}async identify(e,t={}){const{raster:i,serviceRasterInfo:s}=this;if(null!=s.multidimensionalInfo&&!(s.hasMultidimensionalTranspose&&((0,E.DY)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new a.A("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.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.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.serviceRasterInfo?.multidimensionalInfo;return(0,E.z2)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,E.fy)(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.A;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{i(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){i(this);const{raster:e}=this,t=(0,he.w6)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){i(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,he.ci)(t));const s=(0,E.ct)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name;if(!this.renderer||"override"===e){const e=(0,he.PD)(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,he.$P)({...this.renderer.toJSON(),variableName:n}),a=(0,he.m7)(t,n);this.symbolizer?(this.symbolizer.rendererJSON=r,this.symbolizer.rasterInfo=a):this.symbolizer=new fe.A({rendererJSON:r,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=(0,he.PD)(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 o.A.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function i(e){if(!e.raster||!e.serviceRasterInfo)throw new a.A("imagery-tile","no raster")}return(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"_cachedRendererJson",void 0),(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"_cachedRasterFunctionJson",void 0),(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"_compatibleFullExtent",void 0),(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"_rasterJobHandler",void 0),(0,s._)([(0,h.MZ)()],t.prototype,"bandIds",void 0),(0,s._)([(0,h.MZ)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,s._)([(0,h.MZ)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,s._)([(0,h.MZ)()],t.prototype,"interpolation",void 0),(0,s._)([(0,h.MZ)()],t.prototype,"ioConfig",void 0),(0,s._)([(0,h.MZ)({type:[A.A],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,s._)([(0,h.MZ)({type:M.A,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,s._)([(0,h.MZ)()],t.prototype,"raster",void 0),(0,s._)([(0,h.MZ)({type:k.A,json:{name:"renderingRule",write:!0}})],t.prototype,"rasterFunction",null),(0,s._)([(0,h.MZ)({readOnly:!0})],t.prototype,"rasterInfo",null),(0,s._)([(0,h.MZ)()],t.prototype,"serviceRasterInfo",void 0),(0,s._)([(0,h.MZ)()],t.prototype,"sourceJSON",void 0),(0,s._)([(0,h.MZ)({readOnly:!0,type:Q.A,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,s._)([(0,h.MZ)({type:C.A})],t.prototype,"tileInfo",void 0),(0,s._)([(0,h.MZ)(T.OZ)],t.prototype,"url",null),(0,s._)([(0,h.MZ)({types:v.uy,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.Gj,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,s._)([(0,I.w)("renderer")],t.prototype,"readRenderer",null),(0,s._)([(0,h.MZ)({clonable:!1})],t.prototype,"symbolizer",void 0),t=(0,s._)([(0,m.$)("esri.layers.mixins.ImageryTileMixin")],t),t};var ge=i(16131),ye=i(8303),xe=i(54310),we=i(25036),ve=i(82935),_e=i(20437),be=i(13868),Ie=i(87186),Se=i(15265);function Re(e){const t=e.fields,i=e.records,s=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",n=[{name:s,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),r=n.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[s]=o++,l=1;l<r.length;l++)t[r[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:n,features:a}}class Te{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 s=t.getUint32(4,!0),n=t.getUint16(8,!0),r=t.getUint16(10,!0),a={version:i,recordCount:s,headerByteCount:n,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,Se.w)(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<s&&e.byteLength-o>r;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,Se.w)(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 s=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(s.substring(0,4),10),parseInt(s.substring(4,6),10)-1,parseInt(s.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=r}}return{header:a,fields:l,records:c,recordSet:Re({fields:l,records:c})}}}var Ae=i(41086);const Me=new Map;Me.set("int16","esriFieldTypeSmallInteger"),Me.set("int32","esriFieldTypeInteger"),Me.set("int64","esriFieldTypeInteger"),Me.set("float32","esriFieldTypeSingle"),Me.set("float64","esriFieldTypeDouble"),Me.set("text","esriFieldTypeString");let ke=class extends ie{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(!function(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}(t))throw new a.A("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:s}=function(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,colormap:s,blockWidth:n,blockHeight:r,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics?.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.histograms?.[0]?.counts?.length?e.histograms:null,h=e.extent.spatialReference,f=e.geodataXform?.spatialReference,p=new Q.A(h?.wkid||h?.wkt||h?.wkt2?h:f);let d=new K.A({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:p});const m=new L.A({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:p}),g=Math.round((d.xmax-d.xmin)/m.x),y=Math.round((d.ymax-d.ymin)/m.y),x=function(e){if(!(0,Ae.J)(e))throw new a.A("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,Ae.l)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.A("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}(e.geodataXform),w=x?d:null;x&&(d=x.forwardTransform(d),m.x=(d.xmax-d.xmin)/g,m.y=(d.ymax-d.ymin)/y);const v=e.properties??{},_=e.format.toLowerCase().replace("cache/",""),b=new L.A(e.origin.x,e.origin.y,p);let I,S,R,T;if(s?.colors)for(I=[],S=0;S<s.colors.length;S++)R=s.colors[S],T=s.values?s.values[S]:S,I.push([T,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const A=e.LODInfos,M=[];for(S=0;S<A.levels.length;S++)M.push(new D.A({level:A.levels[S],resolution:A.resolutions[S],scale:96/.0254*A.resolutions[S]}));const k=new C.A({dpi:96,lods:M,format:_,origin:b,size:[n,r],spatialReference:p}),F={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},O=[{maxCol:Math.ceil(g/n)-1,maxRow:Math.ceil(y/r)-1,minCol:0,minRow:0}];let P=2;if(l>0)for(S=0;S<l;S++)O.push({maxCol:Math.ceil(g/P/n)-1,maxRow:Math.ceil(y/P/r)-1,minCol:0,minRow:0}),P*=2;const z=e.mdInfo;let E=null;if(z&&v._yxs){const e=v._yxs;E={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:F,rasterInfo:new Ie.A({width:g,height:y,pixelType:t,bandCount:i,extent:d,nativeExtent:w,transform:x,spatialReference:p,pixelSize:m,keyProperties:v,statistics:c,histograms:u,multidimensionalInfo:z,colormap:I,storageInfo:new N.A({blockWidth:n,blockHeight:r,pyramidBlockWidth:n,pyramidBlockHeight:r,origin:b,tileInfo:k,transposeInfo:E,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:O})})}}(t);if("thematic"===s.dataType){const e=await this._fetchAuxiliaryInformation();s.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",s),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,s={}){const{transposeInfo:n}=this.rasterInfo.storageInfo,{transposedVariableName:r}=s,a=!(!n||!r),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,s.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:s.signal});if(!u)return null;const h=function(e,t){const i=e.subarray(t,t+8);let s,n=0;for(s=0;s<5;s++)n|=(255&i[s])<<8*s;const r=0xffffffffff&n;for(n=0,s=5;s<8;s++)n|=(255&i[s])<<8*(s-5);return{position:r,recordSize:0xffffffffff&n}}(new Uint8Array(u.data),c);if(0===h.recordSize)return null;const f=await this.request(l,{range:{from:h.position,to:h.position+h.recordSize},responseType:"array-buffer",signal:s.signal});if(!f)return null;const[p,d]=this._getTileSize(a);return this.decodePixelBlock(f.data,{width:p,height:d,planes:null,pixelType:null,returnInterleaved:a})}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)),s=await Promise.all([t,i]);let n;if(s[0]){let e=s[0].fields;const t=s[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":Me.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(n={fields:e,features:i})}}return!n&&s[1]&&(n=Te.parse(s[1]).recordSet),ae.A.fromJSON(n)}_buildCacheFilePath(e,t,i,s,n){const r=this._getPackageSize(!!n),a=Math.floor(t/r)*r,o=Math.floor(i/r)*r,l="R"+Fe(a)+"C"+Fe(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=s?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!n){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=function(e){return""===(e=e.trim())?"_v":e.replaceAll(/[\{|\}\-]/g,"_").replace("\\*","_v")}(n||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}_getIndexRecordFromBundle(e,t,i=!1){const s=this._getPackageSize(i),n=s*(e%s)+t%s;if(n<0)throw new Error("Invalid level / row / col");return 20+n*this.storageInfo.recordSize+44}};function Fe(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}(0,s._)([(0,h.MZ)({readOnly:!0})],ke.prototype,"storageInfo",void 0),(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),ke=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.CloudRaster")],ke);const Ce=ke;var Oe=i(68197),Pe=i(73444);function ze(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function De(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Ne(e){const{axes:t}=e.domain,i=Object.keys(t),s=[],n=[];let r=-1,a=-1,o=[];for(let e=0;e<i.length;e++){const l=i[e];ze(l)?r=e:De(l)&&(a=e);const c=t[l],u=[];if("values"in c){c.values.forEach((e=>u.push("string"==typeof e?new Date(e).getTime():e)));const e=u[1]-u[0];s.push([u[0]-.5*e,u[u.length-1]+.5*e]),n.push(e)}else{const{start:e,stop:t,num:i}=c,r=(t-e)/(i-1);s.push([e-.5*r,t+.5*r]),n.push(r);for(let t=0;t<i;t++)u.push(e+r*t)}o.push({name:l,values:u,extent:[u[0],u[u.length-1]]})}r>-1&&-1===a?a=0===r?1:0:a>-1&&-1===r?r=0===a?1:0:-1===a&&-1===r&&(r=0,a=1),o=o.filter(((e,t)=>!(t===r||t===a)));const{referencing:l}=e.domain,c=l.find((e=>e.coordinates.includes(i[r]))).system.id,u=c?.slice(c.lastIndexOf("/")+1),h=null==u||"CRS84"===u?4326:Number(u),f=new Q.A({wkid:h}),[p,d]=s[r],[m,g]=s[a],y=new K.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:f});return{width:Math.round(y.width/n[r]),height:Math.round(y.height/n[a]),extent:y,dimensions:o}}function Ee(e){const t=(0,Pe.Z0)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function Be(){return Math.round(255*Math.random())}function Le(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let s=0;s<e.length;s++){const n=e[s];null!=n&&(n<t&&(t=n),n>i&&(i=n))}return(0,$.X1)(t,i)}function Je(e,t,i){const s=e.map(((e,i)=>({name:e,count:t[i]}))).sort(((e,t)=>e.name>t.name?-1:1)),n=(r=1,e=>r*=e.count);var r;const a=[...s.slice(1),{name:"",count:1}].reverse().map(n).reverse();let o=0;for(let n=e.length-1;n>=0;n--)o+=a[s.findIndex((({name:t})=>t===e[n]))]*(i%t[n]),i=Math.floor(i/t[n]);return o}let He=class extends ie{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}async open(e){await this.init();const t=this.source,{pixelBlocks:i,attributeTable:s,statistics:n,histograms:r,name:a,nativeExtent:o,transform:l}=t,c=i[0],{width:u,height:h,pixelType:f}=c,p=t.extent??new K.A({xmin:-.5,ymin:.5,xmax:u-.5,ymax:h-.5,spatialReference:new Q.A({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,m={x:p.width/u,y:p.height/h},g={...t.keyProperties};s&&(g.DataType="Thematic");const y=new Ie.A({width:u,height:h,pixelType:f,extent:p,nativeExtent:o,attributeTable:s,transform:l,pixelSize:m,spatialReference:p.spatialReference,bandCount:c.pixels.length,keyProperties:g,multidimensionalInfo:t.multidimensionalInfo,statistics:n,isPseudoSpatialReference:d,histograms:r});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(y),this.createRemoteDatasetStorageInfo(y,512,512),this._set("rasterInfo",y),this.updateTileInfo(),y.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,y.multidimensionalInfo):await this._buildInMemoryRaster(c,{width:512,height:512},e),y.multidimensionalInfo||(this.source=null),this.datasetName=a}fetchRawTile(e,t,i,s={}){if(!this._pixelBlockTiles){const{rasterInfo:n}=this,[r,a]=n.storageInfo.tileInfo.size,{sliceId:o}=s,{pixelBlocks:l}=this.source,c={pixelBlock:null==o?l[0]:l[o],useBilinear:"thematic"!==n.dataType,tileSize:{width:r,height:a},level:e,row:t,col:i},u=this.rasterJobHandler?this.rasterJobHandler.clipTile(c,s):(0,V.J$)(c);return Promise.resolve(u)}const n=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(n)}async _buildInMemoryRaster(e,t,i){const{rasterInfo:s}=this,n=s.storageInfo.maximumPyramidLevel??0,r="thematic"!==s.dataType,o=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n,useBilinear:r},i):Promise.resolve((0,V.lD)(e,t,n,r)),l=null!=s.statistics,u=null!=s.histograms,h=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,ue.f4)(e)),f=await(0,c.Lx)([o,h]);if(!f[0].value&&f[1].value)throw new a.A("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=f[0].value,l||(s.statistics=f[1].value?.statistics),u||(s.histograms=f[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let s=0;s<t.variables.length;s++){const n=t.variables[s];if(n.statistics)continue;const r=n.dimensions.map((e=>new A.A({variableName:n.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0}))),a=(0,E.NG)(r,t),o=null==a?null:e[a];if(null==o)continue;const l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:o},i):(0,ue.eH)(o);n.statistics=l.statistics,n.histograms||(n.histograms=l.histograms)}}};(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),(0,s._)([(0,h.MZ)()],He.prototype,"source",void 0),(0,s._)([(0,h.MZ)()],He.prototype,"url",null),He=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.InMemoryRaster")],He);const qe=He;let Ge=class extends ie{constructor(){super(...arguments),this.datasetFormat="CovJSON"}async open(e){await this.init();const{extent:t,pixelBlocks:i,multidimensionalInfo:s,attributeTable:n,bandNames:r}=await this._fetchData(e),{statistics:a,histograms:o}=(0,ue.eH)(i[0]),l=r?.map((e=>({BandName:e}))),c={DataType:n?"Thematic":s?"Scientific":"Generic",BandProperties:l},u=new qe({source:{extent:t,pixelBlocks:i,attributeTable:n?ae.A.fromJSON(n):null,multidimensionalInfo:s,statistics:a,histograms:o,keyProperties:c,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;const h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new a.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new a.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new a.A(i,"Missing domain referencing in the grid coverage data");const s=Object.values(t.ranges);for(let e=0;e<s.length;e++){const{axisNames:t,shape:n,type:r,values:o}=s[e];if(!("ndarray"===r.toLowerCase()&&o?.length&&t?.length&&n?.length))throw new a.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!ze(t[t.length-1])||!De(t[t.length-2]))throw new a.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){const{width:t,height:i,extent:s,dimensions:n}=Ne(e),{ranges:r}=e,a=Object.keys(r).sort(((e,t)=>e<t?-1:1)),o=[];for(let e=0;e<a.length;e++){const t=a[e];n?.length&&o.push({name:t,dimensions:n})}const l=function(e){const t={},{parameters:i}=e;if(!i)return t;for(const[e,s]of Object.entries(i)){const{type:i,description:n,unit:r,categoryEncoding:a,observedProperty:o}=s;if("Parameter"===i&&(t[e]={},n&&(t[e].description=Ee(n)),r&&(t[e].unit=r.label?Ee(r.label):null,t[e].symbol=r.symbol?.value),a)){const i=Object.entries(a).map(((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})));let s=!1;o?.categories?.length&&(o.categories.forEach((e=>{if(!e.id)return;const t=e.id.slice(e.id.lastIndexOf("/")+1),n=i.find((e=>e.ClassName===t));if(!n)return;const r=e.label?Ee(e.label):null;if(n.Label=r,e.preferredColor){const t=Oe.A.fromHex(e.preferredColor);t&&(s=!0,n.Red=t.r,n.Green=t.g,n.Blue=t.b)}})),s&&i.forEach((e=>{null==e.Red&&(e.Red=Be(),e.Green=Be(),e.Blue=Be())})));const n={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map((e=>({attributes:e})))};s&&n.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=n}}return t}(e);o.forEach((e=>l[e.name]&&Object.assign(e,l[e.name])));const c=o.length?{variables:o}:void 0,u=[];for(let e=0;e<a.length;e++){const s=a[e],{values:o,dataType:l,axisNames:c,shape:h}=r[s],f=h.length>2?e*h.slice(0,-2).reduce(((e,t)=>e*t)):0,p=c.slice(0,-2),d=h.slice(0,-2),m="float"===l?"f32":Le(o),g=t*i,y=o.length/g;for(let s=0;s<y;s++){const r=ne.A.createEmptyBand(m,g),a=new Uint8Array(g).fill(255);let l=!1;const c=s*g;for(let e=0;e<g;e++){const t=o[c+e];null==t?(a[e]=0,l=!0):r[e]=t}if(0===e||n?.length){const e=new ne.A({width:t,height:i,mask:l?a:null,pixels:[r],pixelType:m});e.updateStatistics(),n?.length?u[Je(p,d,s)+f]=e:u.push(e)}else{const e=u[s];e.pixels.push(r),l?e.mask&&(e.mask=ne.A.combineBandMasks([e.mask,a])):e.mask=l?a:null}}}const h=Object.values(l).find((e=>e.attributeTable))?.attributeTable;return{extent:s,pixelBlocks:u,multidimensionalInfo:c,attributeTable:h,bandNames:c?void 0:a}}(t)}};(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],Ge.prototype,"datasetFormat",void 0),(0,s._)([(0,h.MZ)({constructOnly:!0})],Ge.prototype,"source",void 0),Ge=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.CovJSONRaster")],Ge);const We=Ge;var je=i(4576);function Ze(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 s=[];if(t){const n=Ze(e,i);for(let e=0;e<n.length;e++)Ze(n[e],t).forEach((e=>s.push(e)));return s}const n=e.getElementsByTagNameNS("*",i);if(!n||0===n.length)return[];for(let e=0;e<n.length;e++)s.push(n[e]||n.item(e));return s}function $e(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 s=Ze(e,i);return s.length>0?t?$e(s[0],t):s[0]:null}function Ue(e,t=null){const i=t?$e(e,t):e;let s;return i?(s=i.textContent||i.nodeValue,s?s.trim():null):null}function Ve(e,t){return function(e,t){const i=Ze(e,t),s=[];let n;for(let e=0;e<i.length;e++)n=i[e].textContent||i[e].nodeValue,n&&(n=n.trim(),""!==n&&s.push(n));return s}(e,t).map((e=>Number(e)))}function Xe(e,t){const i=Ue(e,t);return Number(i)}function Ye(e,t){const i=e?.nodeName?.toLowerCase(),s=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===s}var Ke=i(21312);function Qe(e,t){if(!e||!t)return null;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),i.push(t[s]);return i}function et(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new Q.A({wkid:t});if(e=String(e).trim(),(0,S.jp)(e))return new Q.A({wkt2:e});const i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;const s=i.indexOf("VERTCS"),n=i.indexOf("PROJCS"),r=n>-1?n:i.indexOf("GEOGCS");if(-1===r)return null;const a=e.slice(r,e.lastIndexOf("]",s)+1).trim(),o=e.slice(s,e.lastIndexOf("]")).trim();t=tt(a);const l=new Q.A(t?{wkid:t}:{wkt:a}),c=tt(o);return c&&(l.vcsWkid=c),l}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=tt(e),new Q.A(0!==t?{wkid:t}:{wkt:e})):null}function tt(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),s=i[0]?.toLowerCase();if(("epsg"===s||"esri"===s)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function it(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(Ye(e,"SRS")){if(!t.spatialReference){const i=Ue(e);t.spatialReference=et(i)}}else if(Ye(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:s}=function(e){const t=$e(e,"GeodataXform"),i=et(Xe(t,"SpatialReference/WKID")||Ue(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const s=Xe(t,"PolynomialOrder")??1,n=Ve(t,"CoeffX/Double"),r=Ve(t,"CoeffY/Double"),a=Ve(t,"InverseCoeffX/Double"),o=Ve(t,"InverseCoeffY/Double"),l=Qe(n,r),c=Qe(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Ke.A({spatialReference:i,polynomialOrder:s,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=s,t.spatialReference||(t.spatialReference=i)}else Ze(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=Ue(e)));else if(Ye(e,"PAMRasterBand")){const i=function(e){const t=Xe(e,"NoDataValue"),i=$e(e,"Histograms/HistItem"),s=Xe(i,"HistMin"),n=Xe(i,"HistMax"),r=Xe(i,"BucketCount"),a=Ue(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Ze(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=Xe(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=s&&null!=n?{min:s,max:n,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(je.Ru):null;const s=!!i[0].histogram;t.histograms=s?i.map((e=>e.histogram)).filter(je.Ru):null}return t}let st=class extends ie{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:s,histograms:n,transform:r}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new Q.A({wkid:3857})),n?.length&&null==s&&(s=(0,ue.Pg)(n));const{width:o,height:l}=t;let c=new K.A({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 qe({source:{extent:u,nativeExtent:c,transform:r,pixelBlocks:[t],statistics:s,histograms:n,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(f.ioConfig.skipMapInfo=!0),await f.open(),f.source=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,U.g)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.A("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const s=i.toLowerCase(),n="gif"===s||"bmp"===s||!(0,p.A)("ios"),r=await this.decodePixelBlock(t,{format:s,useCanvas:n,hasNoZlibMask:!0});if(null==r)throw new a.A("image-aux-raster:open","the data cannot be decoded");return r}async _fetchAuxiliaryData(e){const t=e?.signal,{skipExtensions:i=[],skipMapInfo:s}=this.ioConfig,n=s||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,a="JPG"===r?"jgw":"PNG"===r?"pgw":"BMP"===r?"bpw":null,o=a&&i.includes(a)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+a,{responseType:"text",signal:t}),l=await(0,c.Lx)([n,o]);if(t?.aborted)throw(0,c.NK)();const u=it(l[0].value?.data);if(!u.transform){const e=l[1].value?l[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;u.transform=6===e?.length?new Ke.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],st.prototype,"datasetFormat",void 0),st=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.ImageAuxRaster")],st);const nt=st;var rt=i(97768),at=i(84952),ot=i(25943),lt=i(73037),ct=i(82371);let ut=class extends ie{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?.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 s=i.data;if(this.sourceJSON=s,!s)throw new a.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!s.tileInfo)throw new a.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=s.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(s.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===s.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=s.name?.slice(s.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:t});if(null==n)throw new a.A("image-server-raster:open","cannot initialize image service");(0,ct.E9)(n,s);const r="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:n,maxLOD:r}=t;if(null!=n&&null!=r)return C.A.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=n&&e<=r))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,n=i?t(i):1/0,r=s?t(s):-1/0;return C.A.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=n&&i>=r}))})}return C.A.fromJSON(e)}(s.tileInfo,s):C.A.fromJSON(s.tileInfo);(0,rt.Lw)(r);const[o,l]=this._computeMinMaxLOD(n,r),{extent:c,pixelSize:u}=n,h=.5/n.width*u.x,f=Math.max(u.x,u.y),{lods:p}=r;("Map"!==this.tileType&&0!==s.maxScale||Math.abs(u.x-u.y)>h||!p.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,n.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),n.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const d=o.level-l.level,[m,g]=r.size,y=[],x=[];p.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&y.push({x:e.resolution,y:e.resolution}),t<p.length-1&&x.push(Math.round(10*e.resolution/p[t+1].resolution)/10)})),y.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,g,r.origin,y,d),v=y.length>1?y.slice(1):null;let _;s.transposeInfo&&(_={tileSize:[s.transposeInfo.rows,s.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0});const b=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(n.storageInfo=new N.A({blockWidth:r.size[0],blockHeight:r.size[1],pyramidBlockWidth:r.size[0],pyramidBlockHeight:r.size[1],pyramidResolutions:v,pyramidScalingFactor:b,compression:r.format,origin:r.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:r,transposeInfo:_,blockBoundary:w}),function(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new lt.A,e.extent=e.transform.forwardTransform(t))}(n),this._set("rasterInfo",n),s.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:(0,at.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new ot.d({layer:e})}}async fetchRawTile(e,t,i,s={}){const{storageInfo:n,extent:r}=this.rasterInfo,{transposeInfo:a}=n,o=null!=a&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const l=o?0:n.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:s.signal});if(!h)return null;const f=o?a.tileSize:n.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=n.blockBoundary[e];if("jpg"!==n.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return p;const{origin:m,blockWidth:g,blockHeight:y}=n,{x,y:w}=this.getPyramidPixelSize(e),v=Math.round((r.xmin-m.x)/x)%g,_=Math.round((r.xmax-m.x)/x)%g||g,b=Math.round((m.y-r.ymax)/w)%y,I=Math.round((m.y-r.ymin)/w)%y||y,S=i===d.minCol?v:0,R=t===d.minRow?b:0,T=i===d.maxCol?_:g,A=t===d.maxRow?I:y;return(0,V.z$)(p,{x:S,y:R},{width:T-S,height:A-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)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([i,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),n[1]?.[0]?.counts?.length||(n[1]=null),{statistics:n[0]||null,histograms:n[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 s=0;const{maximumPyramidLevel:n}=this.rasterInfo.storageInfo;let r=n-s+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--,s++,i=this.identifyPixelLocation(a,s,t.datumTransformation),null===i)return null}return-1===r||null==i?null:s}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),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),n=Q.A.fromJSON(t.spatialReference||e.spatialReference),r=new L.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n});return new Ie.A({width:i,height:s,bandCount:3,extent:K.A.fromJSON(e),spatialReference:n,pixelSize:r,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=(0,ct.Tw)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),n=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data?.slices)).catch((()=>null)):null,r=await Promise.all([s,n]);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)}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:n}=t,r=t.lodAt(Math.max.apply(null,n.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,n.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=n[0].level,[r,a];if("Raster"===o)return[n.find((e=>e.resolution===i.x))??r,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=n.find((e=>Math.abs(e.scale-c)<s)),u||(u=n.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??r));let h=a;return l>0&&(h=n.find((e=>Math.abs(e.scale-l)<s))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],ut.prototype,"datasetFormat",void 0),(0,s._)([(0,h.MZ)()],ut.prototype,"tileType",void 0),ut=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.ImageServerRaster")],ut);const ht=ut;var ft=i(47124);const pt=new Map;pt.set("Int8","s8"),pt.set("UInt8","u8"),pt.set("Int16","s16"),pt.set("UInt16","u16"),pt.set("Int32","s32"),pt.set("UInt32","u32"),pt.set("Float32","f32"),pt.set("Float64","f32"),pt.set("Double64","f32");const dt=new Map;dt.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),dt.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),dt.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),dt.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let mt=class extends ie{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:s,files:n}=this._parseHeader(i.data),{skipMapInfo:r,skipExtensions:a=[]}=this.ioConfig;if(!a.includes("aux.xml")&&!r){const t=await this._fetchAuxiliaryData(e);null!=t&&(s.statistics=t.statistics??s.statistics,s.histograms=t.histograms,t.histograms&&null==s.statistics&&(s.statistics=(0,ue.Pg)(t.histograms)))}r&&this.updateImageSpaceRasterInfo(s),this._set("rasterInfo",s),this._files=n;const o=await this.request(n.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,s,n,r,a;if(ft.Z){for(i=new Uint8Array(e),n=new ArrayBuffer(e.byteLength),s=new Uint8Array(n),r=0;r<e.byteLength/4;r++)for(a=0;a<4;a++)s[4*r+a]=i[4*r+3-a];t=new Uint32Array(n)}else t=new Uint32Array(e);return t}(o.data);const{blockWidth:l,blockHeight:c}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:f}=this.rasterInfo,p=[],d=this._getBandSegmentCount();let m=0,g=-1;for(;m<this._storageIndex.length;){g++;const e=Math.ceil(h/l/u**g)-1,t=Math.ceil(f/c/u**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){const{blockWidth:n,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(n*r);return new ne.A({width:n,height:r,pixels:void 0,mask:e,validPixelCount:0})}const{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[];let g=0;for(g=0;g<d;g++)p&&!p.includes(g)||m.push(this.request(this._files.data,{range:{from:u[g].from,to:u[g].to},responseType:"array-buffer",signal:s.signal}));const y=await Promise.all(m),x=y.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x),v=[];let _=0;for(g=0;g<d;g++)v.push(_),w.set(new Uint8Array(y[g].data),_),_+=y[g].data.byteLength;const b=dt.get(this.rasterInfo.storageInfo.compression).decoderFormat,I=await this.decodePixelBlock(w.buffer,{width:n,height:r,format:b,planes:p?.length||l,offsets:v,pixelType:c});if(null==I)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==b&&!I.mask&&(S=S[0],null!=S)){const e=I.width*I.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(g=0;g<e;g++)Math.abs((I.pixels[0][g]-S)/S)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)I.pixels[0][g]!==S&&(t[g]=1);I.mask=t}let R=0,T=0;if(h!==n||f!==r){let e=I.mask;if(e)for(g=0;g<r;g++)if(T=g*n,g<f)for(R=h;R<n;R++)e[T+R]=0;else for(R=0;R<n;R++)e[T+R]=0;else for(e=new Uint8Array(n*r),I.mask=e,g=0;g<f;g++)for(T=g*n,R=0;R<h;R++)e[T+R]=1}return I}_getBandSegmentCount(){return dt.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:s,blockHeight:n,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/s/p),u=Math.ceil(o/n/p),f+=c*u;p=r**e,c=Math.ceil(a/s/p),u=Math.ceil(o/n/p),f+=t*c+i,f*=4*l;const d=this._storageIndex.subarray(f,f+4*l);let m=0,g=0;const y=[];for(let e=0;e<l;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3],y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<c-1?s:Math.ceil(a/p)-s*(c-1),actualTileHeight:t<u-1?n:Math.ceil(o/p)-n*(u-1)}}_parseHeader(e){const t=$e(e,"MRF_META/Raster");if(!t)throw new a.A("mrf:open","not a valid MRF format");const i=$e(t,"Size"),s=parseInt(i.getAttribute("x"),10),n=parseInt(i.getAttribute("y"),10),r=parseInt(i.getAttribute("c"),10),o=(Ue(t,"Compression")||"none").toLowerCase();if(!dt.has(o))throw new a.A("mrf:open","currently does not support compression "+o);const l=Ue(t,"DataType")||"UInt8",c=pt.get(l);if(null==c)throw new a.A("mrf:open","currently does not support pixel type "+l);const u=$e(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),p=$e(t,"DataValues");let d,m;if(p&&(m=p.getAttribute("NoData"),null!=m&&(d=m.trim().split(" ").map((e=>parseFloat(e))))),$e(e,"MRF_META/CachedSource"))throw new a.A("mrf:open","currently does not support MRF referencing other data files");const g=$e(e,"MRF_META/GeoTags"),y=$e(g,"BoundingBox");let x,w=!1;if(null!=y){const e=parseFloat(y.getAttribute("minx")),t=parseFloat(y.getAttribute("miny")),i=parseFloat(y.getAttribute("maxx")),s=parseFloat(y.getAttribute("maxy")),n=Ue(g,"Projection")||"";let r=Q.A.WGS84;if("LOCAL_CS[]"!==n)if(n.toLowerCase().startsWith("epsg:")){const e=Number(n.slice(5));isNaN(e)||0===e||(r=new Q.A({wkid:e}))}else r=et(n)??Q.A.WGS84;else w=!0,r=new Q.A({wkid:3857});x=new K.A(e,t,i,s),x.spatialReference=r}else w=!0,x=new K.A({xmin:-.5,ymin:.5-n,xmax:s-.5,ymax:.5,spatialReference:new Q.A({wkid:3857})});const v=$e(e,"MRF_META/Rsets"),_=parseInt(v?.getAttribute("scale")||"2",10),b=x.spatialReference,I=new N.A({origin:new L.A({x:x.xmin,y:x.ymax,spatialReference:b}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:_}),S=new L.A({x:x.width/s,y:x.height/n,spatialReference:b}),R=new Ie.A({width:s,height:n,extent:x,isPseudoSpatialReference:w,spatialReference:b,bandCount:r,pixelType:c,pixelSize:S,noDataValue:d,storageInfo:I}),T=Ue(e,"datafile"),A=Ue(e,"IndexFile");return{rasterInfo:R,files:{mrf:this.url,index:A||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",dt.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return it(t)}catch{return null}}};(0,s._)([(0,h.MZ)()],mt.prototype,"_files",void 0),(0,s._)([(0,h.MZ)()],mt.prototype,"_storageIndex",void 0),(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],mt.prototype,"datasetFormat",void 0),mt=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.MRFRaster")],mt);const gt=mt;var yt=i(45664),xt=i(47915);const wt=(e,t)=>e.get(t)?.values,vt=(e,t)=>e.get(t)?.values?.[0];let _t=class extends ie{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.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:n,isBigTiff:r}=(0,yt.uT)(i),l=[];await this._readIFDs(l,i,s,n,0,r?8:4,t);const{imageInfo:c,rasterInfo:u}=function(e){const t=(0,yt.uc)(e),{width:i,height:s,tileWidth:n,tileHeight:r,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:p,affine:d,metadata:m}=t;let g=et(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),y=!!t.isPseudoGeographic;null==g&&(y=!0,g=new Q.A({wkid:3857}));const x=new K.A({...t.extent,spatialReference:g}),w=new L.A(x?{x:x.xmin,y:x.ymax,spatialReference:g}:{x:0,y:0}),v=new N.A({blockWidth:n,blockHeight:r,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:p}),_=new L.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),b=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let I=null;const S=vt(e[0],"PHOTOMETRICINTERPRETATION"),R=wt(e[0],"COLORMAP");if(S<=3&&R?.length>3&&R.length%3==0){I=[];const e=R.length/3;for(let t=0;t<e;t++)I.push([t,R[t]>>>8,R[t+e]>>>8,R[t+2*e]>>>8])}const T=new Ie.A({width:i,height:s,bandCount:a,pixelType:o,pixelSize:_,storageInfo:v,spatialReference:g,isPseudoSpatialReference:y,keyProperties:b,extent:x,colormap:I,statistics:m?m.statistics:null});return d?.length&&(T.nativeExtent=new K.A({xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:g}),T.transform=new Ke.A({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 L.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),v.origin.x=-.5,v.origin.y=.5),{imageInfo:t,rasterInfo:T}}(l),h=(0,yt.zS)(l),f=(0,yt.r9)(l);if(this._headerInfo={littleEndian:s,isBigTiff:r,ifds:l,pyramidIFDs:h,maskIFDs:f,...c},this._set("rasterInfo",u),!c.isSupported)throw new a.A("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new a.A("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");u.isPseudoSpatialReference&&o.A.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.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:m,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!m){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,ue.Pg)(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 L.A({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}(t,u)}g.includes("vat.dbf")||1!==u.bandCount||"u8"!==u.pixelType||m||(u.attributeTable=await this._fetchAuxiliaryTable(e),null!=u.attributeTable&&(u.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(u),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const n=await this._fetchRawTiffTile(e,t,i,!1,s);if(null!=n&&this._headerInfo.hasMaskBand){const r=await this._fetchRawTiffTile(e,t,i,!0,s);null!=r&&r.pixels[0]instanceof Uint8Array&&(n.mask=r.pixels[0])}return n}async _readIFDs(e,t,i,s,n,r=4,a){if(!s)return null;(s>=t.byteLength||s<0)&&(t=(await this.request(this.url,{range:{from:s+n,to:s+n+this._bufferSize},responseType:"array-buffer",signal:a})).data,n=s+n,s=0);const o=await this._readIFD(t,i,s,n,xt.A.tiffTags,r,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-n,n,r,a)}async _readIFD(e,t,i,s,n=xt.A.tiffTags,r=4,a){if(!e)return null;const o=(0,yt.JM)(e,t,i,s,n,r);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const n=i.map((e=>e.offlineOffsetSize)).filter(je.Ru),r=Math.min.apply(null,n.map((e=>e[0])));if(Math.min.apply(null,n.map((e=>e[0]+e[1])))-r<=this._bufferSize){const{data:n}=await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:a});e=n,s=r,i.forEach((i=>(0,yt.Cr)(e,t,i,s)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),n=i?.values;if(n&&n.length>4){const r=n[0]+"."+n[1]+"."+n[2],o=await this._readIFD(e,t,i.valueOffset+6-s,s,xt.A.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:s,to:s+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,s,xt.A.tiffTags,4,a)}}async _fetchRawTiffTile(e,t,i,s,n={}){const r=this._getTileLocation(e,t,i,s);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:n.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 s=h[t].data;e.set(new Uint8Array(s),i),d[t]=i,i+=s.byteLength,m[t]=s.byteLength}}const{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null});if(null==x)return null;let w,v,_;if(o!==g||l!==y){let e=x.mask;if(e)for(w=0;w<y;w++)if(_=w*g,w<l)for(v=o;v<g;v++)e[_+v]=0;else for(v=0;v<g;v++)e[_+v]=0;else for(e=new Uint8Array(g*y),x.mask=e,w=0;w<l;w++)for(_=w*g,v=0;v<o;v++)e[_+v]=1}return x}_getTileLocation(e,t,i,s=!1){const{firstPyramidLevel:n,blockBoundary:r}=this.rasterInfo.storageInfo,a=0===e?0:e-(n-1),{_headerInfo:o}=this;if(!o)return null;const l=s?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,yt.XO)(l,o),u=wt(l,"TILEOFFSETS");if(void 0===u)return null;const h=wt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:p,maxRow:d,maxCol:m}=r[a];if(t>d||i>m||t<f||i<p)return null;const g=vt(l,"IMAGEWIDTH"),y=vt(l,"IMAGELENGTH"),x=vt(l,"TILEWIDTH"),w=vt(l,"TILELENGTH"),v=[];if(c){const{bandCount:e}=this.rasterInfo;for(let s=0;s<e;s++){const e=s*(d+1)*(m+1)+t*(m+1)+i;v[s]={from:u[e],to:u[e]+h[e]-1}}}else{const e=t*(m+1)+i;v.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<v.length;e++)if(null==v[e].from||!v[e].to||v[e].to<0)return null;return{ranges:v,ifd:l,actualTileWidth:i===m&&g%x||x,actualTileHeight:t===d&&y%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return it(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=Te.parse(t);return i?.recordSet?ae.A.fromJSON(i.recordSet):null}catch{return null}}};(0,s._)([(0,h.MZ)()],_t.prototype,"_files",void 0),(0,s._)([(0,h.MZ)()],_t.prototype,"_headerInfo",void 0),(0,s._)([(0,h.MZ)()],_t.prototype,"_bufferSize",void 0),(0,s._)([(0,h.MZ)({type:String,json:{write:!0}})],_t.prototype,"datasetFormat",void 0),_t=(0,s._)([(0,m.$)("esri.layers.support.rasterDatasets.TIFFRaster")],_t);const bt=_t,It=new Map;It.set("CRF",{desc:"Cloud Raster Format",constructor:Ce}),It.set("MRF",{desc:"Meta Raster Format",constructor:gt}),It.set("TIFF",{desc:"GeoTIFF",constructor:bt}),It.set("RasterTileServer",{desc:"Raster Tile Server",constructor:ht}),It.set("JPG",{desc:"JPG Raster Format",constructor:nt}),It.set("PNG",{desc:"PNG Raster Format",constructor:nt}),It.set("GIF",{desc:"GIF Raster Format",constructor:nt}),It.set("BMP",{desc:"BMP Raster Format",constructor:nt}),It.set("CovJSON",{desc:"COVJSON Raster Format",constructor:We}),It.set("MEMORY",{desc:"In Memory Raster Format",constructor:qe});class St{static get supportedFormats(){const e=new Set;return It.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,source:s,sourceJSON:n}=e;let r=e.datasetFormat??i?.datasetFormat;null==r&&(t.includes(".")?r=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===s?.type?.toLowerCase()?r="CovJSON":s?.extent&&s.pixelblocks&&(r="MEMORY")),"OVR"===r||"TIF"===r?r="TIFF":"JPG"===r||"JPEG"===r||"JFIF"===r?r="JPG":"COVJSON"===r&&(r="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const o={url:t,source:s,sourceJSON:n,datasetFormat:r,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(o).forEach((e=>{null==o[e]&&delete o[e]})),r){if(!this.supportedFormats.has(r))throw new a.A("rasterfactory:open","not a supported format "+r);if("CRF"===r&&!i?.enableCRF)throw new a.A("rasterfactory:open",`cannot open raster: ${t}`);const s=new(0,It.get(r).constructor)(o);return await s.open({signal:e.signal}),s}const l=Array.from(It.keys()).filter((e=>"CovJSON"!==e&&"Memory"!==e));let c=0;const u=()=>{if(r=l[c++],!r)return null;if("CRF"===r&&!i?.enableCRF)return null;const t=new(0,It.get(r).constructor)(o);return t.open({signal:e.signal}).then((()=>t)).catch((()=>u()))};return u()}static register(e,t,i){It.has(e.toUpperCase())||It.set(e.toUpperCase(),{desc:t,constructor:i})}}var Rt=i(30291),Tt=i(92935);let At=class extends((0,x.d)((0,we.j)((0,ge.q)((0,ye.A)((0,w.d)(me((0,ve.e)((0,y.b)((0,xe.J)((0,l.P)((0,r.O)(g.A)))))))))))){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.source=void 0,this._debouncedSaveOperations=(0,c.sg)((async(e,t,s)=>{const{save:n,saveAs:r}=await i.e(9838).then(i.bind(i,59838));switch(e){case Tt.X.SAVE:return n(this,t);case Tt.X.SAVE_AS:return r(this,s,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.QP).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new _e.A({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new _e.A({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{serviceRasterInfo:t}=this,i=t?.attributeTable,s=null!=i?i.fields:null;if(s){const t=s.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 n=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===n||"vector-uv"===n)&&null!=r){const t=r.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new _e.A({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new _e.A({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,Rt.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i})}async generateRasterInfo(e,t){if(!(e=(0,f.PZ)(k.A,e)))return this.serviceRasterInfo;try{const{rasterInfo:i}=await this._openFunctionRaster(e,t);return i}catch(e){if(e instanceof a.A)throw e;throw new a.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(Tt.X.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Tt.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?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.A("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)await this._openFromRaster(this.raster,e),t="Function"===this.raster.datasetFormat;else{const{url:t,rasterFunction:i,source:s}=this;if(!t&&!s)throw new a.A("imagery-tile-layer:open","missing url or source parameter");s?await this._openFromSource(s,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}const i=this.raster.rasterInfo;if(!i)throw new a.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){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.serviceRasterInfo.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.wB)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters="Function"===e.datasetFormat?e.primaryRasters.rasters:[e],this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,i){const s=[e];t&&(0,ce.UD)(t.toJSON(),s);const n=await Promise.all(s.map((e=>St.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:i})))),r=n.findIndex((e=>null==e));if(r>-1)throw new a.A("imagery-tile-layer:open",`cannot open raster: ${s[r]}`);return this._primaryRasters=n,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const i=await St.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==i)throw new a.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){const i="the tiled imagery data source is not supported",s="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!s)throw new a.A("imagery-tile-layer:open",i);"MEMORY"===s&&(e={extent:e.extent,pixelBlocks:[e.pixelBlock]});const n=await St.open({url:"",source:e,datasetFormat:s,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==n)throw new a.A("imagery-tile-layer:open",i);this._primaryRasters=[n],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=n}async _openFunctionRaster(e,t){const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const s=(0,ce.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),n=new le({rasterFunction:s});return await n.open(t),n}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof a.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};(0,s._)([(0,h.MZ)({clonable:!1})],At.prototype,"_primaryRasters",void 0),(0,s._)([(0,h.MZ)({type:[f.jz],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],At.prototype,"bandIds",void 0),(0,s._)([(0,h.MZ)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,d.e)(be.SZ)],At.prototype,"interpolation",void 0),(0,s._)([(0,h.MZ)(T.fV)],At.prototype,"legendEnabled",void 0),(0,s._)([(0,h.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],At.prototype,"isReference",void 0),(0,s._)([(0,h.MZ)({type:["show","hide"]})],At.prototype,"listMode",void 0),(0,s._)([(0,h.MZ)({json:{read:!0,write:!0}})],At.prototype,"blendMode",void 0),(0,s._)([(0,h.MZ)()],At.prototype,"sourceJSON",void 0),(0,s._)([(0,h.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],At.prototype,"version",void 0),(0,s._)([(0,h.MZ)({readOnly:!0,json:{read:!1}})],At.prototype,"type",void 0),(0,s._)([(0,h.MZ)({type:["ArcGISTiledImageServiceLayer"]})],At.prototype,"operationalLayerType",void 0),(0,s._)([(0,h.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],At.prototype,"popupEnabled",void 0),(0,s._)([(0,h.MZ)({type:n.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],At.prototype,"popupTemplate",void 0),(0,s._)([(0,h.MZ)({readOnly:!0})],At.prototype,"defaultPopupTemplate",null),(0,s._)([(0,h.MZ)({readOnly:!0,type:[_e.A]})],At.prototype,"fields",void 0),(0,s._)([(0,h.MZ)({readOnly:!0,type:[_e.A]})],At.prototype,"rasterFields",null),(0,s._)([(0,h.MZ)({constructOnly:!0})],At.prototype,"source",void 0),At=(0,s._)([(0,m.$)("esri.layers.ImageryTileLayer")],At);const Mt=At},91806:(e,t,i)=>{i.d(t,{A:()=>u});var s,n=i(90237),r=i(25482),a=i(10107),o=i(56507),l=(i(87811),i(44208),i(40608));let c=s=class extends r.oY{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 s({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,n._)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"cols",void 0),(0,n._)([(0,a.MZ)({type:o.jz,json:{write:!0}})],c.prototype,"level",void 0),(0,n._)([(0,a.MZ)({type:String,json:{write:!0}})],c.prototype,"levelValue",void 0),(0,n._)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"origin",void 0),(0,n._)([(0,a.MZ)({type:Number,json:{write:!0}})],c.prototype,"resolution",void 0),(0,n._)([(0,a.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"rows",void 0),(0,n._)([(0,a.MZ)({type:Number,json:{write:!0}})],c.prototype,"scale",void 0),c=s=(0,n._)([(0,l.$)("esri.layers.support.LOD")],c);const u=c},87045:(e,t,i)=>{i.d(t,{A:()=>S});var s,n=i(90237),r=i(66552),a=i(25482),o=i(83047),l=i(10107),c=i(56507),u=(i(87811),i(44208),i(36005)),h=i(40608),f=i(43937),p=i(86738),d=i(16930),m=i(19419),g=i(21325),y=i(28735),x=i(91806),w=i(72802);const v=new r.J({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 _=s=class extends a.oY{static create(e={}){const{resolutionFactor:t=1,scales:i,size:n=256,spatialReference:r=d.A.WebMercator,numLODs:a=24}=e;if(!(0,g.fn)(r)){const e=[];if(i)for(let t=0;t<i.length;t++){const s=i[t];e.push(new x.A({level:t,scale:s,resolution:s}))}else{let t=5e-4;for(let i=a-1;i>=0;i--)e.unshift(new x.A({level:i,scale:t,resolution:t})),t*=2}return new s({dpi:96,lods:e,origin:new p.A(0,0,r),size:[n,n],spatialReference:r})}const l=(0,g.Vp)(r),c=e.origin?new p.A({x:e.origin.x,y:e.origin.y,spatialReference:r}):new p.A(l?{x:l.origin[0],y:l.origin[1],spatialReference:r}:{x:0,y:0,spatialReference:r}),u=1/(39.37*(0,o.GA)(r)*96),h=[];if(i)for(let e=0;e<i.length;e++){const t=i[e],s=t*u;h.push(new x.A({level:e,scale:t,resolution:s}))}else{let e=(0,g.EA)(r)?512/n*591657527.5917094:256/n*591657527.591555;const i=Math.ceil(a/t);h.push(new x.A({level:0,scale:e,resolution:e*u}));for(let s=1;s<i;s++){const i=e/2**t,n=i*u;h.push(new x.A({level:s,scale:i,resolution:n})),e=i}}return new s({dpi:96,lods:h,origin:c,size:[n,n],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,g.Vp)(e);return e.isWrappable&&!!i&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return p.A.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0;const s=[],n=this._levelToLOD={};e&&(t=-1/0,i=1/0,e.forEach((e=>{s.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,n[e.level]=e}))),this._set("scales",s),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),s=i+1;return t[i]/(t[i]/t[s])**(e-i)}scaleToZoom(e){const t=this.scales,i=t.length-1;let s=0;for(;s<i;s++){const i=t[s],n=t[s+1];if(i<=e)return s;if(n===e)return s+1;if(i>e&&n<e)return s+Math.log(i/e)/Math.log(i/n)}return s}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,s){const n=this.lodAt(e);if(!n)return null;let r,a;if("number"==typeof t)r=t,a=i;else if((0,g.aI)(t.spatialReference,this.spatialReference))r=t.x,a=t.y,s=i;else{const e=(0,y.Cv)(t,this.spatialReference);if(null==e)return null;r=e.x,a=e.y,s=i}const o=n.resolution*this.size[0],l=n.resolution*this.size[1];return s||(s=new w.U(null,0,0,0,(0,m.vt)())),s.level=e,s.row=Math.floor((this.origin.y-a)/l+.001),s.col=Math.floor((r-this.origin.x)/o+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=s.ExtrapolateOptions.NONE){let i=this.lodAt(e.level);if(!i&&t===s.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return;const n=e.level-i.level,r=i.resolution*this.size[0]/2**n,a=i.resolution*this.size[1]/2**n;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,m.vt)()),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:s}=i,n=s*this.size[0],r=s*this.size[1];return e[0]=this.origin.x+t.col*n,e[1]=this.origin.y-(t.row+1)*r,e[2]=e[0]+n,e[3]=e[1]+r,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return s.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const t=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===t)return this;const i=[],n=this.lods.length-t;for(let e=0;e<n;e++){const s=e+t,{scale:n,resolution:r}=s>=0?this.lods[s]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};i.push(new x.A({level:e,scale:n,resolution:r}))}return new s({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 s=e[i];this._upsampleLevels[s.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/s.resolution:0},t=s}}};var b,I;(0,n._)([(0,l.MZ)({type:Number,json:{write:!0}})],_.prototype,"compressionQuality",void 0),(0,n._)([(0,l.MZ)({type:Number,json:{write:!0}})],_.prototype,"dpi",void 0),(0,n._)([(0,l.MZ)({type:String,json:{read:v.read,write:v.write,origins:{"web-scene":{read:!1,write:!1}}}})],_.prototype,"format",void 0),(0,n._)([(0,l.MZ)({readOnly:!0})],_.prototype,"isWrappable",null),(0,n._)([(0,l.MZ)({type:p.A,json:{write:!0}})],_.prototype,"origin",void 0),(0,n._)([(0,u.w)("origin")],_.prototype,"readOrigin",null),(0,n._)([(0,l.MZ)({type:[x.A],value:null,json:{write:!0}})],_.prototype,"lods",null),(0,n._)([(0,l.MZ)({readOnly:!0})],_.prototype,"scales",void 0),(0,n._)([(0,l.MZ)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],_.prototype,"size",void 0),(0,n._)([(0,u.w)("size",["rows","cols"])],_.prototype,"readSize",null),(0,n._)([(0,f.K)("size",{cols:{type:c.jz},rows:{type:c.jz}})],_.prototype,"writeSize",null),(0,n._)([(0,l.MZ)({type:d.A,json:{write:!0}})],_.prototype,"spatialReference",void 0),_=s=(0,n._)([(0,h.$)("esri.layers.support.TileInfo")],_),b=_||(_={}),(I=b.ExtrapolateOptions||(b.ExtrapolateOptions={}))[I.NONE=0]="NONE",I[I.POWER_OF_TWO=1]="POWER_OF_TWO";const S=_},72802:(e,t,i)=>{i.d(t,{U:()=>s});class s{constructor(e,t,i,s,n=void 0){this.id=e,this.level=t,this.row=i,this.col=s,this.extent=n}}},25943:(e,t,i)=>{i.d(t,{d:()=>S});var s,n=i(90237),r=i(78888),a=i(69622),o=i(71903),l=i(49186),c=i(36563),u=i(55359),h=i(3694),f=i(74887),p=i(36708),d=i(11932),m=i(84952),g=i(10107),y=(i(44208),i(53966),i(87811),i(40608)),x=i(72802),w=i(4576),v=i(4718),_=i(34275);class b{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);const{location:t,data:i}=e;this.location=Object.freeze((0,v.o8)(t));const s=this.location.width,n=this.location.height;let r=!0,a=!0;const o=function(e,t=!1){return e<=_.y9?t?new Array(e).fill(0):new Array(e):new Uint32Array(e)}(Math.ceil(s*n/32));let c=0;for(let e=0;e<i.length;e++){const t=e%32;i[e]?(a=!1,o[c]|=1<<t):r=!1,31===t&&++c}a?(this._availability="unavailable",this.byteSize=40):r?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,_.Ek)(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),s=i%32,n=i>>5,r=this._availability;return n<0||n>r.length?"unknown":r[n]&1<<s?"available":"unavailable"}static fromDefinition(e,t){const i=e.service.request||r.A,{row:s,col:n,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:s,left:n,width:a,height:o},valid:!0,data:(0,w.dY)(a*o,0)};throw e})).then((e=>{if(e.location&&(e.location.top!==s||e.location.left!==n||e.location.width!==a||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:s,left:n,width:a,height:o}});return b.fromJSON(e)}))}static fromJSON(e){return Object.freeze(new b(e))}}function I(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}let S=s=class extends a.A{constructor(e){super(e),this._pendingTilemapRequests={},this.request=r.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2*o.u.MEGABYTES),this.addHandles((0,p.wB)((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition()),p.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}fetchTilemap(e,t,i,s){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const n=this._tmpTilemapDefinition,r=this._tilemapFromCache(e,t,i,n);if(r)return Promise.resolve(r);const a=s?.signal;return s={...s,signal:null},new Promise(((e,t)=>{(0,f.u7)(a,(()=>t((0,f.NK)())));const i=I(n);let r=this._pendingTilemapRequests[i];if(!r){r=b.fromDefinition(n,s).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 s=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return s?s.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,s){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):this.fetchTilemap(e,t,i,s).catch((e=>e)).then((s=>{if(s instanceof b){const n=s.getAvailability(t,i);if("unavailable"===n)throw new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return n}if((0,f.zf)(s))throw s;return"unknown"}))}fetchAvailabilityUpsample(e,t,i,s,n){s.level=e,s.row=t,s.col=i;const r=this.layer.tileInfo;r.updateTileInfo(s);const a=this.fetchAvailability(e,t,i,n).catch((e=>{if((0,f.zf)(e))throw e;if(r.upsampleTile(s))return this.fetchAvailabilityUpsample(s.level,s.row,s.col,s,n);throw e}));return this._fetchAvailabilityUpsamplePrefetch(s.id,e,t,i,n,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,n,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.hA)((()=>{u||(u=!0,l.abort())}));if(this.addHandles(h,o),await(0,d.md)(10,l.signal).catch((()=>{})),u||(u=!0,this.removeHandles(o)),(0,f.G4)(l))return;const p=new x.U(e,t,i,n),m={...r,signal:l.signal},g=this.layer.tileInfo;for(let e=0;s._prefetches.length<s._maxPrefetch&&g.upsampleTile(p);++e){const e=this.fetchAvailability(p.level,p.row,p.col,m);s._prefetches.push(e);const t=()=>{s._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.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,s){s.level=e,s.row=t-t%this.size,s.col=i-i%this.size;const n=I(s);return this._tilemapCache.get(n)}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,s)=>!!e._tilemapFromCache(t,i,s,e._tmpTilemapDefinition)}}};S._maxPrefetch=4,S._prefetches=new h.A({initialSize:s._maxPrefetch}),(0,n._)([(0,g.MZ)({constructOnly:!0})],S.prototype,"layer",void 0),(0,n._)([(0,g.MZ)({constructOnly:!0})],S.prototype,"minLOD",void 0),(0,n._)([(0,g.MZ)({constructOnly:!0})],S.prototype,"maxLOD",void 0),(0,n._)([(0,g.MZ)({constructOnly:!0})],S.prototype,"request",void 0),(0,n._)([(0,g.MZ)({constructOnly:!0})],S.prototype,"size",void 0),S=s=(0,n._)([(0,y.$)("esri.layers.support.TilemapCache")],S)},92300:(e,t,i)=>{i.d(t,{V:()=>r,X:()=>n});var s=i(65864);function n(e){return{geometryType:(0,s.$B)(e[0]),geometries:e.map((e=>e.toJSON()))}}function r(e,t,i){const n=(0,s.xD)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}},2272:(e,t,i)=>{i.d(t,{Dl:()=>a,jV:()=>r,lF:()=>o}),i(92602),i(70333);var s=i(4718),n=i(84952);function r(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function o(e,t,i){const s={};for(const n in e){if("declaredClass"===n)continue;const r=e[n];if(null!=r&&"function"!=typeof r)if(Array.isArray(r))s[n]=r.map((e=>o({item:e},t,i).item));else if("object"==typeof r)if(r.toJSON){const e=r.toJSON(i?.[n]);s[n]=t?e:JSON.stringify(e)}else s[n]=t?r:JSON.stringify(r);else s[n]=r}return s}i(926)},89738:(e,t,i)=>{i.d(t,{e:()=>u});var s=i(97768),n=i(74887),r=i(9775),a=i(32587),o=i(11932),l=i(44794);class c{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new a.A,this._controllers=new a.A,this._processingItems=new a.A,this._pausedSignal=(0,l.v)(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new r.A(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&t&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=(0,s.xt)(this._schedule),this._task=(0,s.xt)(this._task)}get updating(){return!!this._task?.updating||this.running}get length(){return this._processingItems.size+this._queue.length}abort(e){const t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((t=>e.push(t))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((t,i)=>e(i)))}get(e){const t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,t){const i=this.get(e);if(i)return i;const s=new AbortController;let r=null;t&&(r=(0,n.u7)(t,(()=>s.abort())));const a=()=>{o.remove(),null!=r&&r.remove(),this._removeItem(e),this._queue.remove(e),this._scheduleNext()},o=(0,n.NY)(s.signal,(()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),a(),l.reject((0,n.NK)())})),l=(0,n.Tw)();return this._deferreds.set(e,l),this._controllers.set(e,s),l.promise.then(a,a),this._queue.push(e),this._scheduleNext(),l.promise}last(){return this._queue.last()}lastPromise(){const e=this.last();return e?this.get(e):null}peek(){return this._queue.peek()}popLast(){const e=this._queue.popLast();return e&&(this._deferreds.get(e)?.reject((0,n.NK)("Removed from queue")),this._removeItem(e)),e}reset(){const e=[];this._processingItems.forEach((t=>e.push(t))),this._processingItems.clear();for(const t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,o._)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let t;const i=new AbortController,s=new c(e,i);this._processingItems.set(e,s);try{t=this.process(e,i.signal)}catch(e){this._processError(s,e)}(0,n.$X)(t)?(s.promise=t,t.then((e=>this._processResult(s,e)),(e=>this._processError(s,e)))):this._processResult(s,t)}get test(){return{update:e=>this.runTask(e)}}}}}]);