@arcgis/core 6.0.0-next.49 → 6.0.0-next.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/WebEditor/sketchUtils.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcgisGlobal.d.ts +0 -6
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/08dd03bc068862160cb2.js +1 -0
- package/assets/esri/core/workers/chunks/38a5be53c3a11adc82e2.js +1 -0
- package/assets/esri/core/workers/chunks/5f12213ccda1f222f244.js +1 -0
- package/assets/esri/core/workers/chunks/aa6f8ee1e1734488ff10.js +1 -0
- package/assets/esri/core/workers/chunks/d781b7e6f9f9f399cf03.js +1 -0
- package/assets/esri/core/workers/chunks/fb4fe32b0b53d8e57f92.js +1 -0
- package/chunks/Pattern.glsl.js +31 -42
- package/config.js +1 -1
- package/interfaces.d.ts +0 -36
- package/kernel.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +8 -8
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/geospatialPDF/parseAttachmentUtils.js +2 -0
- package/layers/geospatialPDF/sharedUtils.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/package.json +3 -3
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +2 -2
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +2 -2
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionLineRenderObject.js +2 -0
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/interactive/BufferManipulator3D.js +2 -0
- package/views/3d/interactive/BufferRenderObject.js +2 -0
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/LinkChartView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/options/InteractiveToolOptions.js +1 -1
- package/views/interactive/options/ViewOptions.d.ts +5 -1
- package/views/interactive/options/bindViewToolOptions.js +1 -1
- package/views/interactive/sketch/SketchOptions.d.ts +1 -26
- package/views/interactive/sketch/SketchOptions.js +1 -1
- package/views/interactive/snapping/FeatureSnappingLayerSource.d.ts +4 -4
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentElevation.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentMovePoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentSelectedVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateZ.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +8 -8
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/AreaMeasurement2D.d.ts +8 -8
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.d.ts +7 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +18 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +8 -8
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D.d.ts +8 -8
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +23 -23
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.d.ts +24 -24
- package/widgets/Editor.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +25 -25
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.d.ts +24 -24
- package/widgets/Sketch.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GraphicHandler.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.d.ts +3 -3
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/GridControls.d.ts +4 -4
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/SnappingControls/SnappingControlsViewModel.d.ts +5 -5
- package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
- package/widgets/support/SnappingControls/VisibleElements.d.ts +3 -3
- package/widgets/support/SnappingControls.d.ts +7 -7
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/0fd5ff5b6037c89257ec.js +0 -1
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +0 -1
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +0 -1
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +0 -1
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +0 -1
- package/assets/esri/core/workers/chunks/c4974a4dc081e23899ba.js +0 -1
- package/views/interactive/sketch/SketchLabelOptions.d.ts +0 -72
- package/views/interactive/sketch/SketchLabelOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipElevationOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +0 -87
- package/views/interactive/sketch/SketchTooltipOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipVisibleElements.d.ts +0 -19
- package/views/interactive/sketch/SketchTooltipVisibleElements.js +0 -2
- package/views/interactive/sketch/SketchValueOptions.d.ts +0 -27
- package/views/interactive/sketch/SketchValueOptions.js +0 -2
- package/views/interactive/sketch/Units.d.ts +0 -20
- package/views/interactive/sketch/Units.js +0 -2
- package/views/interactive/snapping/SnappingOptions.d.ts +0 -75
- package/views/interactive/snapping/SnappingOptions.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(Array.isArray(self.webpackChunkRemoteClient)?self.webpackChunkRemoteClient:self.webpackChunkRemoteClient=[]).push([[4934],{67996(e,t,r){r.d(t,{cZ:()=>x,XW:()=>F,fe:()=>k});var i=r(56507),n=r(49186),s=r(91869),a=(r(90708),r(92722)),o=r(16930);class l{constructor(){this.version="",this.queryResult=new p}}class p{constructor(){this.featureResult=new u}}class u{constructor(){this.objectIdFieldName="",this.uniqueIdField=new d,this.globalIdFieldName="",this.geohashFieldName="",this.geometryProperties=new h,this.geometryType=null,this.spatialReference=new o.A,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.transform=new c,this.fields=[],this.fieldNameToAttributeIndexMap={},this.values=[],this.features=[],this.geometryFields=[]}}class d{constructor(){this.name="",this.isSystemMaintained=!1}}class h{constructor(){this.shapeAreaFieldName="",this.shapeLengthFieldName="",this.units=""}}class c{constructor(){this.quantizeOriginPosition="upperLeft",this.scale=new y,this.translate=new f}}class y{constructor(){this.xScale=0,this.yScale=0,this.mScale=0,this.zScale=0}}class f{constructor(){this.xTranslate=0,this.yTranslate=0,this.mTranslate=0,this.zTranslate=0}}class m{constructor(){this.name="",this.fieldType="esriFieldTypeString",this.alias="",this.sqlType="sqlTypeVarchar",this.domain="",this.defaultValue=""}}class g{constructor(){this.attributes=[],this.compressedGeometry=new b,this.centroid=new b,this.aggregateGeometries=[]}}class b{constructor(){this.geometryType=null,this.lengths=[],this.coords=[]}}const w=["ELEMENTUID","TYPENAME"];var M=r(45724),I=r(93637),C=r(49403);const _={upperLeft:0,lowerLeft:1},T={sqlTypeBigInt:0,sqlTypeBinary:1,sqlTypeBit:2,sqlTypeChar:3,sqlTypeDate:4,sqlTypeDecimal:5,sqlTypeDouble:6,sqlTypeFloat:7,sqlTypeGeometry:8,sqlTypeGUID:9,sqlTypeInteger:10,sqlTypeLongNVarchar:11,sqlTypeLongVarbinary:12,sqlTypeLongVarchar:13,sqlTypeNChar:14,sqlTypeNVarChar:15,sqlTypeOther:16,sqlTypeReal:17,sqlTypeSmallInt:18,sqlTypeSqlXml:19,sqlTypeTime:20,sqlTypeTimestamp:21,sqlTypeTimestamp2:22,sqlTypeTinyInt:23,sqlTypeVarbinary:24,sqlTypeVarchar:25};function A(e){let t=new l;t.version=e.version;let r=e.get_query_result();if(0!==r.results_type.value)throw Error("Got a non-feature collection type");let i=r.get_feature_result(),n=t.queryResult.featureResult;n.objectIdFieldName=i.objectid_field_name,n.exceededTransferLimit=i.exceeded_transfer_limit,n.hasM=i.has_m,n.hasZ=i.has_z,n.geometryType=(0,I.i7)(C.bV,i.geometry_type.value),n.globalIdFieldName=i.globalid_field_name,n.geohashFieldName=i.geohash_field_name;let s=n.uniqueIdField,a=i.unique_id_field;s.name=a.name,s.isSystemMaintained=a.isSystemMaintained;let o=n.geometryProperties,p=i.geometry_properties;o.shapeAreaFieldName=p.shapeAreaFieldName,o.shapeLengthFieldName=p.shapeLengthFieldName,o.units=p.units;let u=n.spatialReference,d=i.spatial_reference;u.wkid=d.wkid,u.latestWkid=d.latestWkid,u.vcsWkid=d.vcsWkid,u.latestVcsWkid=d.latestVcsWkid,u.wkt=d.wkt,n.transform=function(e){let t=new c;t.quantizeOriginPosition=(0,I.i7)(_,e.quantizeOriginPosition.value);let r=t.scale,i=e.scale;r.xScale=i.xScale,r.yScale=i.yScale,r.mScale=i.mScale,r.zScale=i.zScale;let n=t.translate,s=e.translate;return n.xTranslate=s.xTranslate,n.yTranslate=s.yTranslate,n.mTranslate=s.mTranslate,n.zTranslate=s.zTranslate,t}(i.transform);let h=n.fields,y=n.fieldNameToAttributeIndexMap,f=i.fields,m=f.size();for(let e=0;e<m;e++){let t=f.get(e),r=E(t);h.push(r),y[r.name]=e,t.delete()}f.delete();let b=n.values,M=i.values_count();for(let e=0;e<M;e++)b.push(i.get_value_at(e));let T=n.features,A=i.features,x=A.size();if(x>0)for(let e of w)if(void 0===y[e])throw Error(`Feature collection missing required attribute: ${e}`);for(let e=0;e<x;e++){let t=new g,r=A.get(e),i=t.attributes,n=r.attributes_count();for(let e=0;e<n;e++)i.push(r.get_attribute_at(e));let s=r.get_compressed_geometry();s&&(t.compressedGeometry=v(s),t.centroid=v(r.get_centroid()));let a=t.aggregateGeometries,o=r.aggregate_geometries,l=o.size();for(let e=0;e<l;e++){let t=o.get(e),r=v(t);a.push(r),t.delete()}o.delete(),T.push(t),r.delete()}A.delete();let k=n.geometryFields,L=i.geometry_fields,N=L.size();for(let e=0;e<N;e++){let t=L.get(e),r=S(t);k.push(r),t.delete()}return L.delete(),t}function v(e){let t=new b;t.geometryType=(0,I.i7)(C.bV,e.geometry_type.value);let r=[],i=[];for(let t=0;t<e.lengths.length;t++)r.push(e.lengths[t]);for(let t=0;t<e.coords.length;t++)i.push(e.coords[t]);return t.lengths=r,t.coords=i,t}function E(e){let t=new m;return t.name=e.name,t.alias=e.alias,t.fieldType=(0,I.i7)(C.r5,e.field_type.value),t.sqlType=(0,I.i7)(T,e.sql_type.value),t.domain=e.domain,t.defaultValue=e.default_value,t}function S(e){let t=E(e);return t.geometryType=(0,I.i7)(C.bV,e.geometry_type.value),t}async function x(e,t,r){t??=!1;let a={generateAllSublayers:t,namedTypeDefinitions:new Map};return await async function(e,t){let r=await(await(0,i.A)(e,{responseType:"array-buffer",signal:t?.signal})).data;return async function(e){let t=new((await(0,M.I)()).MapOfObjectIdentifierSetsDecoder),r=t.decode(new Uint8Array(e)),i=new Map;if(0!==r.error_code)throw new n.A("knowledge-graph:layer-support-utils",r.error_message);let s=t.get_map_of_identifier_sets(),a=s.keys,o=a.size();for(let e=0;e<o;e++){let t=a.get(e),r=s.query_identifier_set(t),o=[];if(1===r.id_array_type.value){let e=r.get_globalid_array(),t=e.count();for(let r=0;r<t;r++)o.push(e.get_globalid_at(r))}else if(3===r.id_array_type.value){let e=r.get_identifier_array(),t=e.count();for(let r=0;r<t;r++)o.push(e.get_identifier_at(r).toString())}else if(2===r.id_array_type.value){let e=r.get_string_array(),t=e.count();for(let r=0;r<t;r++)o.push(e.get_string_at(r))}else{if(0!==r.id_array_type.value)throw new n.A("knowledge-graph:layer-support-utils","Tried to encode an unexpected ID Array type.");{let e=r.get_oid_array(),t=e.count();for(let r=0;r<t;r++)o.push(e.get_objectid_at(r).toString())}}i.set(t,o)}return t.delete(),i}(new Uint8Array(r))}(e,r).then(e=>{!function(e,t){for(let[r,i]of e){let e=(0,s.tE)(t.namedTypeDefinitions,r,()=>({useAllData:!1,members:new Map}));for(let t of i)e.members.has(t)||e.members.set(t,{id:t})}}(e,a)}),a}async function k(e){let t=await(0,M.I)(),r=new t.MapOfObjectIdentifierSets;!function(e,t,r){for(let[i,n]of r.namedTypeDefinitions){if(!n.members||n.useAllData)continue;let r=n.members.keys(),s=!1,a=!0,o=new t.ObjectIdArray,l=new t.StringArray,p=new t.GlobalIdArray,u=new t.IdentifierArray,d=new t.ObjectIdentifierSet;for(let e of r)a&&=(s=!isNaN(Number(e)),!1),s?o.add_objectid(Number(e)):(l.add_string(e),p.add_globalid(e)),u.add_identifier(e);d.set_oid_array(o),d.set_string_array(l),d.set_globalid_array(p),d.set_identifier_array(u),o.delete(),l.delete(),p.delete(),u.delete(),e.put_identifier_set(i,d),d.delete()}}(r,t,e);let i=new t.MapOfObjectIdentifierSetsEncoder;try{i.set_map_of_identifier_sets(r),i.encode();let e=i.get_encoding_result();if(0!==e.error.error_code)throw new n.A("knowledge-graph:layer-support-utils",e.error.error_message);let t=structuredClone(e.get_byte_buffer());return i.delete(),t}finally{r.delete()}}async function L(e,t){return async function(e){let t=new((await(0,M.I)()).FeatureCollectionDecoder),r=t.decode(new Uint8Array(e));if(0!==r.error_code)throw new n.A("knowledge-graph:layer-support-utils",r.error_message);let i=A(t.get_feature_collection());return t.delete(),i}(await(await(0,i.A)(e,{responseType:"array-buffer",signal:t?.signal})).data)}function N(e,t){if(!e?.queryResult?.featureResult)return t;let{hasZ:r,hasM:i}=e.queryResult.featureResult,n=e.queryResult.featureResult.fieldNameToAttributeIndexMap;for(let o of e.queryResult.featureResult.features){let e=o.attributes[n.TYPENAME],l=(0,s.tE)(t.namedTypeDefinitions,e,()=>({useAllData:!1,members:new Map})),p=o.attributes[n.ELEMENTUID];if(o.compressedGeometry?.coords?.length>0){let e=o.compressedGeometry.lengths;"esriGeometryPoint"===o.compressedGeometry.geometryType&&(e=[]),l.members.set(p,{id:p,linkChartLocation:new a.A(e,o.compressedGeometry.coords,r,i)})}else l.members.set(p,{id:p})}return t}const F={fetchAndConvertSerializedLinkChart:(e,t)=>async function(e,t){let r=[],i={generateAllSublayers:!1,namedTypeDefinitions:new Map};return e.entitiesUrl&&r.push(L(e.entitiesUrl,t).then(e=>{N(e,i)})),e.relationshipsUrl&&r.push(L(e.relationshipsUrl,t).then(e=>{N(e,i)})),await Promise.all(r),i}(e,t)}},75503(e,t,r){r.d(t,{wq:()=>o});var i=r(4576),n=r(21818),s=(r(44208),r(15142)),a=r(11006);class o{constructor(e=9,t){this._compareMinX=h,this._compareMinY=c,this._toBBox=e=>e,this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&("function"==typeof t?this._toBBox=t:this._initFormat(t)),this.clear()}destroy(){this.clear(),I.prune(),C.prune(),_.prune(),T.prune()}all(e){l(this._data,e)}search(e,t){let r=this._data,i=this._toBBox;if(w(e,r))for(I.clear();r;){for(let n=0,s=r.children.length;n<s;n++){let s=r.children[n],a=r.leaf?i(s):s;w(e,a)&&(r.leaf?t(s):b(e,a)?l(s,t):I.push(s))}r=I.pop()}}collides(e){let t=this._data,r=this._toBBox;if(!w(e,t))return!1;for(I.clear();t;){for(let i=0,n=t.children.length;i<n;i++){let n=t.children[i],s=t.leaf?r(n):n;if(w(e,s)){if(t.leaf||b(e,s))return!0;I.push(n)}}t=I.pop()}return!1}load(e){if(!e.length)return this;if(e.length<this._minEntries){for(let t=0,r=e.length;t<r;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this._data.children.length)if(this._data.height===t.height)this._splitRoot(this._data,t);else{if(this._data.height<t.height){let e=this._data;this._data=t,t=e}this._insert(t,this._data.height-t.height-1,!0)}else this._data=t;return this}insert(e){return e&&this._insert(e,this._data.height-1),this}clear(){return this._data=new E([]),this}remove(e){if(!e)return this;let t,r=this._data,s=null,a=0,o=!1,l=this._toBBox(e);for(_.clear(),T.clear();r||_.length>0;){if(r||(r=_.pop(),s=_.data[_.length-1],a=T.pop()??0,o=!0),r.leaf&&(t=(0,i.qh)(r.children,(0,n.z)(e),r.children.length,r.indexHint),-1!==t))return r.children.splice(t,1),_.push(r),this._condense(_),this;o||r.leaf||!b(r,l)?s?(a++,r=s.children[a],o=!1):r=null:(_.push(r),T.push(a),a=0,s=r,r=r.children[0])}return this}toJSON(){return this._data}fromJSON(e){return this._data=e,this}_build(e,t,r,i){let n=r-t+1,s=this._maxEntries;if(n<=s){let i=new E(e.slice(t,r+1));return p(i,this._toBBox),i}i||(i=Math.ceil(Math.log(n)/Math.log(s)),s=Math.ceil(n/s**(i-1)));let a=new S([]);a.height=i;let o=Math.ceil(n/s),l=o*Math.ceil(Math.sqrt(s));M(e,t,r,l,this._compareMinX);for(let n=t;n<=r;n+=l){let t=Math.min(n+l-1,r);M(e,n,t,o,this._compareMinY);for(let r=n;r<=t;r+=o){let n=Math.min(r+o-1,t);a.children.push(this._build(e,r,n,i-1))}}return p(a,this._toBBox),a}_insert(e,t,r){let i=this._toBBox,n=r?e:i(e);_.clear();let s=function(e,t,r,i){for(;i.push(t),!0!==t.leaf&&i.length-1!==r;){let r,i=1/0,n=1/0;for(let s=0,a=t.children.length;s<a;s++){let a=t.children[s],o=y(a),l=m(e,a)-o;l<n?(n=l,i=o<i?o:i,r=a):l===n&&o<i&&(i=o,r=a)}t=r||t.children[0]}return t}(n,this._data,t,_);for(s.children.push(e),d(s,n);t>=0&&_.data[t].children.length>this._maxEntries;)this._split(_,t),t--;!function(e,t,r){for(let i=r;i>=0;i--)d(t.data[i],e)}(n,_,t)}_split(e,t){let r=e.data[t],i=r.children.length,n=this._minEntries;this._chooseSplitAxis(r,n,i);let s=this._chooseSplitIndex(r,n,i);if(!s)return;let a=r.children.splice(s,r.children.length-s),o=r.leaf?new E(a):new S(a);o.height=r.height,p(r,this._toBBox),p(o,this._toBBox),t?e.data[t-1].children.push(o):this._splitRoot(r,o)}_splitRoot(e,t){this._data=new S([e,t]),this._data.height=e.height+1,p(this._data,this._toBBox)}_chooseSplitIndex(e,t,r){let i,n,s;i=n=1/0;for(let a=t;a<=r-t;a++){let t=u(e,0,a,this._toBBox),o=u(e,a,r,this._toBBox),l=g(t,o),p=y(t)+y(o);l<i?(i=l,s=a,n=p<n?p:n):l===i&&p<n&&(n=p,s=a)}return s}_chooseSplitAxis(e,t,r){let i=e.leaf?this._compareMinX:h,n=e.leaf?this._compareMinY:c;this._allDistMargin(e,t,r,i)<this._allDistMargin(e,t,r,n)&&e.children.sort(i)}_allDistMargin(e,t,r,i){e.children.sort(i);let n=this._toBBox,s=u(e,0,t,n),a=u(e,r-t,r,n),o=f(s)+f(a);for(let i=t;i<r-t;i++){let t=e.children[i];d(s,e.leaf?n(t):t),o+=f(s)}for(let i=r-t-1;i>=t;i--){let t=e.children[i];d(a,e.leaf?n(t):t),o+=f(a)}return o}_condense(e){for(let t=e.length-1;t>=0;t--){let r=e.data[t];if(0===r.children.length)if(t>0){let n=e.data[t-1],s=n.children;s.splice((0,i.qh)(s,r,s.length,n.indexHint),1)}else this.clear();else p(r,this._toBBox)}}_initFormat(e){let t=["return a"," - b",";"];this._compareMinX=Function("a","b",t.join(e[0])),this._compareMinY=Function("a","b",t.join(e[1])),this._toBBox=Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}function l(e,t){let r=e;for(C.clear();r;){if(!0===r.leaf)for(let e of r.children)t((0,n.z)(e));else C.pushArray(r.children);r=C.pop()??null}}function p(e,t){u(e,0,e.children.length,t,e)}function u(e,t,r,i,n){n||=new E([]),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let s,a=t;a<r;a++)s=e.children[a],d(n,e.leaf?i(s):s);return n}function d(e,t){e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY)}function h(e,t){return e.minX-t.minX}function c(e,t){return e.minY-t.minY}function y(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function f(e){return e.maxX-e.minX+(e.maxY-e.minY)}function m(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function g(e,t){let r=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),n=Math.min(e.maxX,t.maxX),s=Math.min(e.maxY,t.maxY);return Math.max(0,n-r)*Math.max(0,s-i)}function b(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function w(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function M(e,t,r,i,n){let s=[t,r];for(;s.length;){let t=s.pop(),r=s.pop();if(t-r<=i)continue;let o=r+Math.ceil((t-r)/i/2)*i;(0,a.q)(e,o,r,t,n),s.push(r,o,o,t)}}const I=new s.A,C=new s.A,_=new s.A,T=new s.A({deallocator:void 0});class A{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}class v extends A{constructor(){super(...arguments),this.height=1,this.indexHint=new i.vW}}class E extends v{constructor(e){super(),this.children=e,this.leaf=!0}}class S extends v{constructor(e){super(),this.children=e,this.leaf=!1}}},69397(e,t,r){r.d(t,{JY:()=>c,Qf:()=>l,Qh:()=>a,lM:()=>s,ro:()=>p,rq:()=>u});var i=r(44208),n=r(34275);function s(e){if(!e)return 0;let t=d;for(let r in e)e.hasOwnProperty(r)&&(t+=o(e[r],!1));return t}function a(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return u(e,8);let r=h;for(let i=0;i<t;i++)r+=o(e[i]);return r}(e);let t=d;for(let r in e)e.hasOwnProperty(r)&&(t+=o(e[r]));return t}function o(e,t=!0){switch(typeof e){case"object":return t?a(e):d;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+p(t),0)}function p(e,t=16){return e?(0,n.iu)(e)?e.byteLength+y:Array.isArray(e)?u(e,t):0:0}function u(e,t){return h+e.length*t}const d=32,h=16,c=(0,i.A)("ios")||!(0,i.A)("chrome")&&!(0,i.A)("opr")?8:4,y=145},15795(e,t,r){var i=r(32198),n=r(91429),s=r(58318),a=r(4146),o=r(63074),l=r(25036),p=r(98809),u=r(88625);let d=class extends((0,o.dM)((0,l.j)(a.A))){constructor(e){super(e),this.elevationInfo=null,this.graphics=new p.Y,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}get loaded(){return super.loaded}add(e){return this.graphics.add(e),this}addMany(e){return this.graphics.addMany(e),this}removeAll(){return this.graphics.removeAll(),this}remove(e){this.graphics.remove(e)}removeMany(e){this.graphics.removeMany(e)}graphicChanged(e){this.emit("graphic-update",e)}};(0,i.Cg)([(0,n.MZ)({type:u.A})],d.prototype,"elevationInfo",void 0),(0,i.Cg)([(0,n.MZ)((0,s.C)(p.Y,"graphics"))],d.prototype,"graphics",void 0),(0,i.Cg)([(0,n.MZ)({type:["show","hide"]})],d.prototype,"listMode",void 0),(0,i.Cg)([(0,n.MZ)()],d.prototype,"screenSizePerspectiveEnabled",void 0),(0,i.Cg)([(0,n.MZ)({readOnly:!0})],d.prototype,"type",void 0),(0,i.Cg)([(0,n.MZ)({constructOnly:!0})],d.prototype,"internal",void 0),d=(0,i.Cg)([(0,n.$K)("esri.layers.GraphicsLayer")],d);const h=d;r.d(t,["A",0,h])},6518(e,t,r){r.d(t,{F:()=>o});var i=r(44208),n=r(75503),s=r(19419);const a={minX:0,minY:0,maxX:0,maxY:0};class o{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new n.wq(9,(0,i.A)("esri-csp-restrictions")?e=>({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){let e=Array(this._idByBounds.size),t=0;this._idByBounds.forEach((r,i)=>{e[t++]=i}),this._indexInvalid=!1,this._index.clear(),this._index.load(e)}else this._boundsToLoad.length&&(this._index.load(Array.from(new Set(this._boundsToLoad.filter(e=>this._idByBounds.has(e))))),this._boundsToLoad.length=0)}}get fullBounds(){if(!this._boundsById.size)return null;let e=(0,s.Ie)();for(let t of this._boundsById.values())t&&(e[0]=Math.min(t[0],e[0]),e[1]=Math.min(t[1],e[1]),e[2]=Math.max(t[2],e[2]),e[3]=Math.max(t[3],e[3]));return e}get valid(){return!this._indexInvalid}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(e){let t=this._boundsById.get(e);this._boundsById.delete(e),t&&(this._idByBounds.delete(t),this._indexInvalid||this._index.remove(t))}forEachInBounds(e,t){this._loadIndex(),function(e,t,r){(function(e){a.minX=e[0],a.minY=e[1],a.maxX=e[2],a.maxY=e[3]})(t),e.search(a,r)}(this._index,e,e=>t(this._idByBounds.get(e)))}get(e){return this._boundsById.get(e)}has(e){return this._boundsById.has(e)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(e,t){if(!this._indexInvalid){let t=this._boundsById.get(e);t&&(this._index.remove(t),this._idByBounds.delete(t))}this._boundsById.set(e,t),t&&(this._idByBounds.set(t,e),this._indexInvalid||(this._boundsToLoad.push(t),this._boundsToLoad.length>5e4&&this._loadIndex()))}}},83221(e,t,r){r.d(t,{A:()=>c});var i=r(4576),n=r(49186),s=r(65529),a=r(53966),o=r(70328),l=r(19419),p=r(90708),u=r(6518),d=r(37730);const h=(0,o.vt)();class c{constructor(e){this.geometryInfo=e,this._boundsStore=new u.F,this._featuresById=new Map,this._usedMemory=0,this.events=new s.bk,this.featureAdapter=d.T}get usedMemory(){return this._usedMemory}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{null!=t.geometry&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(null==this.fullBounds)return null;let[t,r,i,n]=this.fullBounds;return{xmin:t,ymin:r,xmax:i,ymax:n,spatialReference:e}}add(e){this._add(e),this._emitChanged()}addMany(e){for(let t of e)this._add(t);this._emitChanged()}upsertMany(e){let t=e.map(e=>this._upsert(e));return this._emitChanged(),t.filter(i.Ru)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){let t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(let t of e){let e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(let r of e){let e=this._boundsStore.get(r.objectId);e&&t((0,o.Jt)(h,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;let t=e.objectId;if(null==t)return void a.A.getLogger("esri.layers.graphics.data.FeatureStore").error(new n.A("featurestore:invalid-feature","feature id is missing",{feature:e}));let r,i=this._featuresById.get(t);i?(e.displayId=i.displayId,r=this._boundsStore.get(t),this._boundsStore.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0):null!=this.onFeatureAdd&&this.onFeatureAdd(e),e.geometry?.coords?.length?(r=(0,p.jQ)(r??(0,l.vt)(),e.geometry),null!=r&&this._boundsStore.set(t,r),this._featuresById.set(t,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0):(this._boundsStore.set(t,null),this._featuresById.set(t,e))}_upsert(e){let t=e?.objectId;if(null==t)return a.A.getLogger("esri.layers.graphics.data.FeatureStore").error(new n.A("featurestore:invalid-feature","feature id is missing",{feature:e})),null;let r=this._featuresById.get(t);if(!r)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(r)??0;let{geometry:i,attributes:s}=e;for(let e in s)r.attributes[e]=s[e];return i&&(r.geometry=i,this._boundsStore.set(t,(0,p.jQ)((0,l.vt)(),i)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(r)??0,r}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);let t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}},37730(e,t,r){var i=r(43334);const n={getObjectId:e=>e.objectId,getAttributes:e=>e.attributes,getAttribute:(e,t)=>e.attributes[t],cloneWithGeometry:(e,t,r)=>new i.Om(t,e.attributes,null,e.objectId,e.displayId,e.distance,e.vertexCount),getGeometry:e=>e.geometry,getCentroid:(e,t)=>e.ensureCentroid(t)};r.d(t,["T",0,n])},64714(e,t,r){r.d(t,{F0:()=>o,Vx:()=>u,e2:()=>h,f:()=>f});var i=r(44208),n=r(4718),s=r(99352),a=r(93470);function o(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?a.Cb:"esriGeometryPolyline"===e?a.yM:a.WR}}}const l=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let p=1;function u(e,t){if((0,i.A)("esri-csp-restrictions"))return()=>t?{[t]:null,...e}:{...e};try{let r="";t&&(r+=`this${d(t)} = null;`);for(let t in e)r+=`this${d(t)} = ${JSON.stringify(e[t])};`;let i=Function(`\n return class AttributesClass$${p++} {\n constructor() {\n ${r};\n }\n }\n `)();return()=>new i}catch{return()=>t?{[t]:null,...e}:{...e}}}function d(e){return l.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}function h(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,n.o8)(e)}}]}const c={...s.F,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!1,supportsDistance:!1,supportsExtent:!1,supportsQuantization:!1,supportsQueryGeometry:!1,supportsDisjointSpatialRelationship:!1},y={...s.P,supportedStatistics:{...s.P.supportedStatistics,envelope:!1,centroid:!1,convexHull:!1}};function f(e,t,r=!1){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:r?c:s.F,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:r?y:s.P,editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:t,supportsTrueCurveUpdateByTrueCurveClientsOnly:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},24137(e,t,r){r.d(t,{P:()=>C});var i=r(32198),n=r(56372),s=r(49186),a=r(53966),o=r(91869),l=r(17676),p=r(39516),u=r(91429),d=r(5443),h=r(39829),c=r(99917),y=r(21325),f=r(15375);const m=(e,t)=>"column-reference"===e.type?e.column===t.systemOidFieldName?"ID(n)":`n.${e.column}`:"string"===e.type?`'${e.value}'`:"number"===e.type?`${e.value}`:"binary-expression"===e.type&&"LIKE"!==e.operator&&t.supportedSqlTypes.has(e.left.type)&&t.supportedSqlTypes.has(e.right.type)&&t.supportedSqlOperators.has(e.operator)?`${m(e.left,t)} ${e.operator} ${m(e.right,t)}`:"binary-expression"===e.type&&"LIKE"===e.operator?function(e,t){if("column-reference"!==e.left.type||"string"!==e.right.type||e.escape)return t.unsupportedOperationFound=!0,"";let r=e.right.value.replaceAll(/%+/g,"%"),i=r.startsWith("%"),n=r.endsWith("%"),s=r.slice(+!!i,n?-1:void 0),a=s.match(/[%_]/g)?.length??0;if(s.length===a)return t.unsupportedOperationFound=!0,"";a>0&&(t.requiresClientSidePagination=!0);let o=s.split(/[%_]/),l=m(e.left,t),p=[];for(let e=0;e<o.length;e++){let t,r=o[e];if(!r)continue;t=1!==o.length||i||n?0!==e||i?e!==o.length-1||n?"CONTAINS":"ENDS WITH":"STARTS WITH":"=";let s=r.replaceAll("\\","\\\\").replaceAll("'","\\'");p.push(`${l} ${t} '${s}'`)}return 1===p.length?p[0]:`(${p.join(" AND ")})`}(e,t):(t.unsupportedOperationFound=!0,"");var g=r(69860),b=r(99916),w=r(53902),M=r(42538),I=r(97552);let C=class extends n.A{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;let t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach(r=>{r.name&&(t.set(r.name,"entity"),this._processingCacheUpdatesLookup.set(r.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.entityTypeNames.add(r.name),r.properties?.forEach(e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(r.name,{name:e.name??"",geometryType:e.geometryType})}))}),e.knowledgeGraph.dataModel.relationshipTypes?.forEach(r=>{r.name&&(t.set(r.name,"relationship"),this._processingCacheUpdatesLookup.set(r.name,[]),(!e.inclusionModeDefinition||e.inclusionModeDefinition?.generateAllSublayers)&&this.relationshipTypeNames.add(r.name),r.properties?.forEach(e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(r.name,{name:e.name??"",geometryType:e.geometryType})}))}),e.inclusionModeDefinition?.namedTypeDefinitions.forEach((r,i)=>{if("entity"===t.get(i))this.entityTypeNames.add(i);else{if("relationship"!==t.get(i))return a.A.getLogger(this).warn(`A named type, ${i}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(i);this.relationshipTypeNames.add(i)}let n=new Map;r.members?.forEach(e=>{(0,o.tE)(this.memberIdTypeLookup,e.id,()=>new Set).add(i)}),this.sublayerCaches.set(i,n)})}addToLayer(e){e.forEach(({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new s.A("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){let r=this.inclusionModeDefinition.namedTypeDefinitions.get(e);r.members||=new Map,r.members.set(t,{id:t}),(0,o.tE)(this.memberIdTypeLookup,t,()=>new Set).add(e)}}else{let r=new Map;r.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:r}),(0,o.tE)(this.memberIdTypeLookup,t,()=>new Set).add(e)}})}getById(e){return g.A.getInstance().readFromStoreById(e)}async getData(e,t,r,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return{features:[],cypherTranslationApplied:!1};let n;if(n=e||new I.A({where:"1=1",outFields:["*"]}),"link-chart"===r.type){let e=r,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),s=n.outFields;s&&1===s.length&&s[0]===f.dr&&"1=1"===n.where||await Promise.all(i??[]);let a=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],o=[];return a.forEach(r=>{if(this.relationshipTypeNames.has(t.objectType.name)){r.geometry=e.relationshipLinkChartDiagramLookup.get(r.attributes[t.objectIdField]);let i=this.memberIdTypeLookup.get(r.attributes[f.Cz]),n=this.memberIdTypeLookup.get(r.attributes[f.KQ]),s=this._isEndEntitySpatial(i,r,f.Cz),a=this._isEndEntitySpatial(n,r,f.KQ);r.attributes[f.BL]=Number(s&&a)}else{r.geometry=e.entityLinkChartDiagramLookup.get(r.attributes[t.objectIdField]);let i=this.geographicLookup.get(t.objectType.name);i&&r.attributes[i.name]?r.attributes[f.BL]=1:r.attributes[f.BL]=0}r.attributes[f.T1]=r.geometry,o.push(r)}),{features:o,cypherTranslationApplied:!1}}return this.retrieveDataFromService(n,t,r,i)}async getConnectedRecordIds(e,t,r){let i=[],n="",s=this._getNamedTypeIdMapFromNodeIds(e);if(t&&0!==t?.length){for(let e of t)n=n+e+"|";n=n.slice(0,-1)}let a={},o=[];for(let[e,r]of s){let i=`${e}_ids`;a[i]=r,t&&0!==t?.length?o.push(`MATCH (n:${e}) WHERE id(n) IN $${i} WITH n MATCH (n)-[r:${n}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`):o.push(`MATCH (n:${e}) WHERE id(n) IN $${i} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`)}if(!o.length)return i;let l=o.join(" UNION "),p=(await(0,w.executeQueryStreaming)(this.knowledgeGraph,new M.A({openCypherQuery:l,bindParameters:a}),{signal:r?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await p.read();if(e)break;for(let e=0;e<t.length;e++){let r=t[e];i.push({id:r[0],typeName:r[1]}),i.push({id:r[2],typeName:r[3]})}}return i}async getRelationshipsBetweenNodes(e,t,r){let i=this._getNamedTypeIdMapFromNodeIds(e);if(0===i.size)return[];let n={relationshipExclusionIds:t,possibleConnectionEntityIds:e},s=[];for(let[e,t]of i.entries()){let r=`${e}_ids`;n[r]=t,s.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r]->(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let a=s.join(" UNION "),o=[],l=(await(0,w.executeQueryStreaming)(this.knowledgeGraph,new M.A({openCypherQuery:a,bindParameters:n}),{signal:r?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;for(let e=0;e<t.length;e++){let r=t[e];o.push({id:r[0],typeName:r[1]})}}return o}async getRelationshipsFromNodes(e,t,r,i){let n=this._getNamedTypeIdMapFromNodeIds(e);if(0===n.size||0===t.length)return[];let s={relationshipExclusionIds:r,possibleConnectionEntityIds:t},a=[];for(let[e,t]of n.entries()){let r=`${e}_ids`;s[r]=t,a.push(`MATCH (n:${e}) WHERE id(n) IN $${r} WITH n MATCH (n)-[r]-(m) WHERE id(m) IN $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds RETURN id(r), type(r)`)}let o=a.join(" UNION "),l=new Map,p=(await(0,w.executeQueryStreaming)(this.knowledgeGraph,new M.A({openCypherQuery:o,bindParameters:s}),{signal:i?.signal})).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await p.read();if(e)break;for(let e=0;e<t.length;e++){let r=t[e],i=l.get(r[1]);i||(i=new Set,l.set(r[1],i)),i.add(r[0])}}let u=[];for(let[e,t]of l)for(let r of t)u.push({id:r,typeName:e});return u}async refreshCacheContent(e,t,r,i=!0,n){let a=g.A.getInstance(),p=[],u=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),this.knowledgeGraph.dataModel.relationshipTypes?.forEach(e=>{e.name&&d.set(e.name,e)}),e||this.inclusionModeDefinition?e?e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let t of this.memberIdTypeLookup.get(e))u.has(t)?u.get(t)?.push(e):u.set(t,[e])}):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{e.useAllData?u.set(t,null):e.members&&e.members.forEach(e=>{u.has(t)&&null!==u.get(t)?u.get(t)?.push(e.id):u.set(t,[e.id])})}):(this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)}),this.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&u.set(e.name,null)}));for(let[e,l]of u){let u=new Set(l),h=new Promise((p,h)=>{(async()=>{let p,h=new Set,c=[],y="",m=!1;if(t||d.get(e)?.properties?.forEach(e=>{e.name&&h.add(e.name)}),r&&this.geographicLookup.has(e)){let t=this.geographicLookup.get(e)?.name;t&&h.add(t)}if(this.entityTypeNames.has(e))y=`MATCH (n:${e}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,h.forEach(e=>{y+=`, n.${e}`,c.push(e)});else{if(!this.relationshipTypeNames.has(e))throw new s.A("knowledge-graph:layer-data-manager",`The graph type of ${e} could not be determined. Was this type set in the KG data model and inclusion definition?`);m=!0,y=`MATCH ()-[n:${e}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,h.forEach(e=>{y+=`, n.${e}`,c.push(e)})}p=l?new M.A({openCypherQuery:y,bindParameters:{ids:l}}):new M.A({openCypherQuery:y});let g=(await(0,w.executeQueryStreaming)(this.knowledgeGraph,p,{signal:n?.signal})).resultRowsStream.getReader();for(;;){let{done:t,value:r}=await g.read();if(t)break;let n=[];for(let e=0;e<r.length;e++){let t=r[e],i=0,s=0,a={properties:{}};for(a.id=t[i],i++,s++,m&&(a.originId=t[i],i++,s++,a.destinationId=t[i],i++,s++,(0,o.tE)(this.nodeConnectionsLookup,a.originId,()=>new Set).add(a.id),(0,o.tE)(this.nodeConnectionsLookup,a.destinationId,()=>new Set).add(a.id),(0,o.tE)(this.relationshipConnectionsLookup,a.id,()=>[a.originId,a.destinationId]));i<t.length;i++)a.properties[c[i-s]]=t[i];u.delete(a.id),n.push(a)}let s=a.writeToStore(n,f.dr,this.geographicLookup.get(e)?.name);this.sublayerCaches.has(e)||this.sublayerCaches.set(e,new Map),i&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(e)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),i&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(e).members=new Map);let l=this.sublayerCaches.get(e);s.forEach(t=>{l?.set(t.attributes[f.dr],t),i&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.has(t.attributes[f.dr])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(e).members.set(t.attributes[f.dr],{id:t.attributes[f.dr]}),(0,o.tE)(this.memberIdTypeLookup,t.attributes[f.dr],()=>new Set).add(e))})}let b=this.inclusionModeDefinition?.namedTypeDefinitions.get(e);if(b)for(let e of u)b.members?.delete(e)})().then(()=>{p(null)}).catch(e=>{"AbortError"===e.name?p(null):h(e)})});p.push(h),this._processingCacheUpdatesLookup.get(e)?.push(h)}if(await Promise.all(p),n?.signal?.aborted)throw(0,l.NK)()}removeFromLayer(e){let t=new Set,r=new Set(e.map(e=>e.id));for(let r of e)t.add(r.typeName),1===this.memberIdTypeLookup.get(r.id)?.size?this.memberIdTypeLookup.delete(r.id):this.memberIdTypeLookup.get(r.id)?.delete(r.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach((e,t)=>{t===r.typeName&&e.members?.has(r.id)&&e.members.delete(r.id)});t.forEach(e=>{this.sublayerCaches.get(e)?.forEach((t,i)=>{r.has(i)&&this.sublayerCaches.get(e)?.delete(i)})})}async retrieveDataFromService(e,t,r,i){let n,o=g.A.getInstance(),l=new Set,u=[],I="",C=[],_=!1,T="relationship"===t.graphType,A=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,v=r.sublayerIdsCache.get(t.objectType.name),E=!A&&v?Array.from(v).sort():null,S={systemOidFieldName:f.dr,supportedSqlTypes:new Set(["column-reference","string","number","binary-expression"]),supportedSqlOperators:new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]),unsupportedOperationFound:!1,requiresClientSidePagination:!1};if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(E=e.objectIds);else{if(!E?.length)return{features:[],cypherTranslationApplied:_};if(null!=e.objectIds){let t=e.objectIds,r=E.filter(e=>t.includes(e));if(t.length>0&&0===r.length)return{features:[],cypherTranslationApplied:_};e.objectIds=r,r.length>0&&(E=r)}else e.objectIds=E}if(null!=e.outFields){let r=e.outFields;r.includes("*")?t.fields.forEach(e=>{l.add(e.name)}):r.forEach(e=>{e!==f.dr&&e!==t.geometryFieldName&&l.add(e)})}if(null!=e.orderByFields&&!e.outFields?.includes("*"))for(let r of e.orderByFields){let[e]=r.trim().split(/\s+/,1),i=t.fieldsIndex.get(e);i&&i.name!==f.dr&&(l.has(i.name)||l.add(i.name))}if(null!=e.geometry){let i,a=e.geometry,o=r.dataManager.knowledgeGraph.serviceDefinition,f=o?.spatialReference,m=o?.serviceCapabilities?.geometryCapabilities,g=m?.geometryMaxBoundingRectangleSizeX,w=m?.geometryMaxBoundingRectangleSizeY;if("point"===a.type){let e=a;e.spatialReference?.isWGS84||(await(0,c.initializeProjection)(e.spatialReference,y.KK),e=(0,c.project)(e,y.KK)),i=new d.A({spatialReference:y.KK,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else a?.extent?.spatialReference&&!a.spatialReference?.isWGS84?(await(0,c.initializeProjection)(a.extent.spatialReference,y.KK),i=(0,c.project)(a.extent,y.KK)):i=a.extent;if(g&&w&&f){if(4326!==f.wkid){let e=new d.A({spatialReference:f,xmax:g,ymax:w}),t=(0,c.project)(e,y.KK);g=t.xmax,w=t.ymax}if(i.xmax-i.xmin>g)throw new s.A("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${g}° latitude, limit exceeded`);if(i.ymax-i.ymin>w)throw new s.A("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${w}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){let r=await(0,p.GP)(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach(e=>{r.fieldNames.includes(e.name)&&l.add(e.name)})}I=T?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&l.add(t.geometryFieldName),l.forEach(e=>{I+=`, n.${e}`,u.push(e)}),n=new M.A({openCypherQuery:I,bindParameters:{param_filter_geom:new h.A({rings:(0,b.Wq)(i)})}})}else{let r="";if(null!=e.where&&"1=1"!==e.where){let i=await(0,p.GP)(e.where,t.fieldsIndex);t.fields.forEach(e=>{i.fieldNames.includes(e.name)&&l.add(e.name)}),r=m(i.parseTree,S),S.unsupportedOperationFound&&(r="")}let i="";i=T?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let s=!1;E&&(s=!0,i+=" WHERE ID(n) IN $ids"),r&&(i+=s?" AND":" WHERE",i+=` ${r}`),i+=" return ID(n)",T&&(i+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&l.add(t.geometryFieldName),l.forEach(e=>{i+=`, n.${e}`,u.push(e)}),!S.unsupportedOperationFound&&!S.requiresClientSidePagination&&(i=((e,t)=>{let r=e;return t.orderByFields?.length&&(r=function(e,t){let r=e.trimEnd();if(/\border\s+by\b/i.test(r))return a.A.getLogger("cypherUtils").warn("Query already contains an ORDER BY clause. Skipping addition of new ORDER BY."),e;let i=t.map(e=>e.trim()).filter(e=>!!e).map(e=>{let[t,r]=e.split(/\s+/,2);return t?`${t===f.dr?"ID(n)":`n.${t}`} ${"DESC"===r?.toUpperCase()?"DESC":"ASC"}`:null}).filter(e=>!!e);return i.length?`${r} ORDER BY ${i.join(", ")}`:e}(r,t.orderByFields)),null!=t.start&&(r=function(e,t){let r=e.trimEnd();return/\bskip\s+(\$\w+|\d+)\b/i.test(r)?(a.A.getLogger("cypherUtils").warn("Query already contains a SKIP clause. Skipping addition of new SKIP."),e):`${r} SKIP ${t}`}(r,t.start)),null!=t.num&&(r=function(e,t){let r=e.trimEnd();return/\blimit\s+(\$\w+|\d+)\b/i.test(r)?(a.A.getLogger("cypherUtils").warn("Query already contains a LIMIT clause. Skipping addition of new LIMIT."),e):`${r} LIMIT ${t}`}(r,t.num)),r})(i,e),_=!0),n=E?new M.A({openCypherQuery:i,bindParameters:{ids:E}}):new M.A({openCypherQuery:i})}let x=(await(0,w.executeQueryStreaming)(r.dataManager.knowledgeGraph,n,i)).resultRowsStream.getReader();for(;;){let{done:e,value:i}=await x.read();if(e)break;let n=[];for(let e=0;e<i.length;e++){let t=i[e],r=0,s=0,a={properties:{}};for(a.id=t[r],r++,s++,T&&(a.originId=t[r],r++,s++,a.destinationId=t[r],r++,s++);r<t.length;r++)a.properties[u[r-s]]=t[r];n.push(a)}C=C.concat(o.writeToStore(n,f.dr,r.dataManager.geographicLookup.get(t.objectType.name)?.name))}return{features:C,cypherTranslationApplied:_}}_isEndEntitySpatial(e,t,r){for(let i of e??[])if(this.entityTypeNames.has(i)){let e=this.geographicLookup.get(i),n=e&&this.sublayerCaches.get(i)?.get(t.attributes[r]);if(e&&n?.attributes[e.name])return!0}return!1}_getNamedTypeIdMapFromNodeIds(e){let t=new Map;return e.forEach(e=>{if(this.memberIdTypeLookup.has(e))for(let r of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(r))return;t.has(r)?t.get(r)?.push(e):t.set(r,[e])}}),t}};(0,i.Cg)([(0,u.MZ)()],C.prototype,"knowledgeGraph",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"inclusionModeDefinition",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"entityTypeNames",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"relationshipTypeNames",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"geographicLookup",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"sublayerCaches",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"nodeConnectionsLookup",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"relationshipConnectionsLookup",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"memberIdTypeLookup",void 0),C=(0,i.Cg)([(0,u.$K)("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],C)},62796(e,t,r){r.d(t,{A:()=>be});var i=r(32198),n=r(40124),s=r(49186),a=r(4718),o=r(53966),l=r(25728),p=r(91429),u=(r(29953),r(78247)),d=r(5443),h=r(86738),c=r(39829),y=r(82799),f=r(99917),m=r(16930),g=r(21325),b=r(50498),w=r(41910),M=r(55156),I=r(60950),C=r(89808),_=r(99959);const T=Symbol("isKnowledgeGraphGraphicOriginSymbol");var A;class v extends _.A{get[(A=T,I.ym)](){return this.sublayer}get[M.e](){return this.sublayer}get[C.Q](){return this.sublayer}get[w.e7](){return this.sublayer}constructor(e,t){super(),this[A]=!0,this.type="knowledge-graph",this.layer=e,this.sublayer=t}get id(){return this.layer.id}}const E=Symbol("isLinkChartGraphicOriginSymbol");var S;class x extends _.A{get[(S=E,I.ym)](){return this.sublayer}get[M.e](){return this.sublayer}get[C.Q](){return this.sublayer}get[w.e7](){return this.sublayer}constructor(e,t){super(),this[S]=!0,this.type="link-chart",this.layer=e,this.sublayer=t}get id(){return`${this.layer.id}:__${this.sublayer.id}__`}}var k=r(4146),L=r(83221),N=r(75752),F=r(64714),R=r(15375);const O=(0,r(17036).p)(),D=e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.fields=[],this.fieldsIndex=null}};return(0,i.Cg)([(0,p.MZ)(O.fields)],r.prototype,"fields",void 0),(0,i.Cg)([(0,p.MZ)(O.fieldsIndex)],r.prototype,"fieldsIndex",void 0),r=(0,i.Cg)([(0,p.$K)("esri.layers.knowledgeGraph.KnowledgeGraphSublayerBase")],r),r};var P=r(40736),j=r(63074),B=r(6455),G=r(87718),$=r(56658),Z=r(32756),q=r(54310),Q=r(25036),U=r(82935),z=r(10873),Y=r(20569),H=r(29005),X=r(20437),W=r(30524),K=r(46499),V=r(39383),J=r(96184),ee=r(96576),te=r(65494),re=r(41214),ie=r(53902),ne=r(22671),se=r(97552),ae=r(30291),oe=r(88625),le=r(37531),pe=r(61322),ue=r(43937);function de(e){if(!e.json)return e;e.json.write=he(e.json.write);let t,r=e.json.origins;if(!r)return e;for(t in r){let e=r[t];e&&(e.write=he(e.write))}return e}function he(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=function(e){let{target:t,writer:r,overridePolicy:i,...n}=e;return function(e,t){let r=ye.call(this,e,t);return r.enabled?{...n,...r}:r}}(e)),e):!0===e?ce():e}function ce(){return{overridePolicy:ye}}function ye(e,t){let r=!!this.geometryType,i={enabled:r};return r&&(i={...i,...fe.call(this,e,t)}),i}function fe(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}function me(e,t){return{...fe.call(this,e,t),allowNull:this.originIdOf(t)>=3}}let ge=class extends(D((0,B.FJ)((0,$.J)((0,G.F)((0,j.dM)((0,Z.fY)((0,U.e)((0,Q.j)((0,q.J)((0,l.M)(k.A))))))))))){constructor(e){super(e),this.blendMode="normal",this.charts=null,this.definitionExpression=null,this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=R.dr,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{let e=new MessageChannel;return new pe.default(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{let r=se.A.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get capabilities(){return this.parent?this.parent.sublayerCapabilities:(0,P.hZ)(null)}get isTable(){return"link-chart"!==this.parentCompositeLayer?.type&&null==this.geometryFieldName}get defaultPopupTemplate(){return this.createPopupTemplate()}get editingEnabled(){return this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get effectiveCapabilities(){let e=(0,a.o8)(this.capabilities),{operations:t,editing:r}=e;return this.userHasUpdateItemPrivileges&&(t.supportsAdd=t.supportsDelete=t.supportsEditing=t.supportsQuery=t.supportsUpdate=r.supportsDeleteByOthers=r.supportsGeometryUpdate=r.supportsUpdateByOthers=!0),this.userHasFullEditingPrivileges&&t.supportsEditing&&(t.supportsAdd=t.supportsDelete=t.supportsUpdate=r.supportsGeometryUpdate=!0),e}get effectiveEditingEnabled(){return this.userHasUpdateItemPrivileges||this.editingEnabled}set featureReduction(e){let t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){let e=[],t=new Map;for(let e of this.parent?.knowledgeGraph.dataModel.domains??[])t.set(e.name,e);return this.objectType?.properties?.forEach(r=>{let i="esriFieldTypeOID"===r.fieldType?"esriFieldTypeInteger":r.fieldType,n=X.A.fromJSON({name:r.name,type:i,alias:r.alias,defaultValue:r.defaultValue,editable:r.editable,nullable:r.nullable,domain:r.domain&&t.has(r.domain)?t.get(r.domain).toJSON():void 0});e.push(n)}),e.push(X.A.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),X.A.fromJSON({name:R.M1,type:"esriFieldTypeInteger",alias:R.M1,editable:!1}),X.A.fromJSON({name:R.BL,type:"esriFieldTypeInteger",alias:R.BL,editable:!1})),e}get formTemplate(){return this._isOverridden("formTemplate")?this._get("formTemplate"):(0,P.dD)(this)}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";let e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name)?.geometryType;return e&&"esriGeometryNull"!==e?b.gy.fromJSON(e):null}get geometryFieldName(){return"link-chart"===this.parentCompositeLayer?.type?R.T1:this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name)?.name??null}get graphicOrigin(){if(!this.parent)return null;switch(this.parent.type){case"knowledge-graph":return new v(this.parent,this);case"link-chart":return new x(this.parent,this)}}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){let e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name)?.name;return(e?this.objectType?.properties?.[e]:null)?.hasM??!1}get hasZ(){let e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name)?.name;return(e?this.objectType?.properties?.[e]:null)?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;let e=this.objectType.properties?(0,P.MY)(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?(0,P.iW)(this.graphType,this.graphTypeName,e):(0,P.e$)(this.graphTypeName,this.geometryType,e)}set renderer(e){(0,W.yp)(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");let e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=(0,P.Td)(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new ee.A({type:"simple",symbol:(0,P.UT)(r)});let e=(0,te.r)((0,F.F0)(b.gy.toJSON("point")).renderer);return(0,le.dt)(e.symbol,r),e}let i=(0,te.r)((0,F.F0)(b.gy.toJSON(this.geometryType)).renderer);return(0,le.dt)(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??m.A.WGS84}get templates(){return this._isOverridden("templates")?this._get("templates"):(0,P.CP)(this)}set templates(e){this._overrideIfSome("templates",e)}set timeInfo(e){this._set("timeInfo",e)}get dateFieldsTimeZone(){return this.parentCompositeLayer?.dateFieldsTimeZone}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}get userHasEditingPrivileges(){return!this.parent||this.parent.userHasEditingPrivileges}get userHasFullEditingPrivileges(){return!!this.parent&&this.parent.userHasFullEditingPrivileges}get userHasUpdateItemPrivileges(){return!!this.parent&&this.parent.userHasUpdateItemPrivileges}createPopupTemplate(e){return(0,ae.tn)(this,e)}createQuery(){return new se.A({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return this.fields.find(t=>t.name===e)?.domain||null}async queryFeatures(e,t){await this.load();let{resolvedQuery:r,queryEngine:i,cypherTranslationApplied:n}=await this._setupQueryObjects(e),s=this.graphicOrigin,a=ne.A.fromJSON(await i.executeQuery(this._createQueryEngineQueryJSON(r,n),t?.signal));return a.features.forEach(e=>{e.sourceLayer=this,e.origin=s}),a}async queryFeaturesJSON(e,t){await this.load();let{resolvedQuery:r,queryEngine:i,cypherTranslationApplied:n}=await this._setupQueryObjects(e);return await i.executeQuery(this._createQueryEngineQueryJSON(r,n),t?.signal)}async queryFeatureCount(e,t){await this.load();let{resolvedQuery:r,queryEngine:i,cypherTranslationApplied:n}=await this._setupQueryObjects(e);return i.executeQueryForCount(this._createQueryEngineQueryJSON(r,n),t?.signal)}async queryExtent(e={},t){await this.load();let r,i={...e,returnGeometry:!0},{resolvedQuery:n,queryEngine:s,cypherTranslationApplied:a}=await this._setupQueryObjects(i),o=await s.executeQueryForExtent(this._createQueryEngineQueryJSON(n,a),t?.signal);return r=null!=o.extent?.xmin&&null!=o.extent?.xmax&&null!=o.extent?.ymin&&null!=o.extent?.ymax?new d.A(o.extent):new d.A,{count:o.count,extent:r}}async queryObjectIds(e,t){await this.load();let r,i=se.A.from(e);if(this.parentCompositeLayer){if("link-chart"!==this.parentCompositeLayer.type||!this._cachedQueryEngine){let{features:e,cypherTranslationApplied:n}=await this.parentCompositeLayer.dataManager.getData(i,this,this.parentCompositeLayer,t);return r=this.loadQueryEngine(e),await r.executeQueryForIds(this._createQueryEngineQueryJSON(i,n),t?.signal)}r=this._cachedQueryEngine}else o.A.getLogger(this).warn("Attempting to query for object IDs with no features failed because the parent composite layer is missing or not yet loaded."),r=this.loadQueryEngine([]);return await r.executeQueryForIds(this._createQueryEngineQueryJSON(i,!1),t?.signal)}async applyEdits(e){if(!this.parentCompositeLayer?.dataManager.knowledgeGraph)throw new s.A("knowledge-graph-sublayer:no-knowledge-graph","ApplyEdits cannot be executed because the parent does not have a Knowledge Graph model. This is usually caused by the layer not yet being loaded");let t=await(0,P.O9)(e,this,this.parentCompositeLayer);t.options={cascadeDelete:!0,cascadeProvenanceDelete:!!this.parent?.knowledgeGraph.serviceDefinition.supportsProvenance||void 0};let r=await(0,ie.executeApplyEdits)(this.parentCompositeLayer.dataManager.knowledgeGraph,t),i=(0,P.Gz)(r,this.graphTypeName),n={addedFeatures:i.addFeatureResults,updatedFeatures:i.updateFeatureResults,deletedFeatures:i.deleteFeatureResults,addedAttachments:i.addAttachmentResults,deletedAttachments:i.deleteAttachmentResults,updatedAttachments:i.updateAttachmentResults,exceededTransferLimit:!1,historicMoment:new Date,edits:void 0};return this.emit("edits",n),this.emit("apply-edits",{result:Promise.resolve(n)}),"link-chart"===this.parentCompositeLayer.type&&await this.parentCompositeLayer.refreshLinkChartCache([...n.addedFeatures.map(e=>e.globalId),...n.updatedFeatures.map(e=>e.globalId),...n.deletedFeatures.map(e=>e.globalId)]),i}loadQueryEngine(e){let t=new L.A({geometryType:b.gy.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new N.do({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:b.gy.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){if(!this.parentCompositeLayer)return o.A.getLogger(this).warn("Attempting to refresh the cached query engine with no features failed because the parent composite layer is missing or not yet loaded."),void(this._cachedQueryEngine=this.loadQueryEngine([]));let{features:e}=await this.parentCompositeLayer.dataManager.getData(new se.A({where:"1=1",outFields:[R.dr]}),this,this.parentCompositeLayer);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>(0,W.sv)(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}_createQueryEngineQueryJSON(e,t){let r=e.toJSON();return t&&delete r.resultOffset,r}async _setupQueryObjects(e,t){let r=se.A.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await(0,f.initializeProjection)(i.spatialReference,g.KK),r.geometry=i instanceof c.A||i instanceof y.A||i instanceof h.A?(0,f.project)(i,g.KK):(0,f.project)(i.extent,g.KK)),!this.parentCompositeLayer)return o.A.getLogger(this).warn("Attempting to execute a query with no features failed because the parent composite layer is missing or not yet loaded."),{resolvedQuery:r,queryEngine:this.loadQueryEngine([]),cypherTranslationApplied:!1};if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine,cypherTranslationApplied:!1};let{features:n,cypherTranslationApplied:s}=await this.parentCompositeLayer.dataManager.getData(r,this,this.parentCompositeLayer,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(n),cypherTranslationApplied:s}}};(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(j.sU)))],ge.prototype,"blendMode",void 0),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"capabilities",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"isTable",null),(0,i.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:ce()}})],ge.prototype,"charts",void 0),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"defaultPopupTemplate",null),(0,i.Cg)([(0,p.MZ)({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],ge.prototype,"definitionExpression",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(B.Dp)))],ge.prototype,"displayFilterEnabled",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(B.KV)))],ge.prototype,"displayFilterInfo",void 0),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"editingEnabled",null),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(j.LF)))],ge.prototype,"effect",void 0),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"effectiveCapabilities",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"effectiveEditingEnabled",null),(0,i.Cg)([(0,p.MZ)({type:oe.A})],ge.prototype,"elevationInfo",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(G.Y)))],ge.prototype,"featureEffect",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(Y.d)))],ge.prototype,"featureReduction",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"fields",null),(0,i.Cg)([(0,p.MZ)({type:u.A})],ge.prototype,"formTemplate",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"geometryType",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"geometryFieldName",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"graphicOrigin",null),(0,i.Cg)([(0,p.MZ)({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ge.prototype,"graphType",void 0),(0,i.Cg)([(0,p.MZ)({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ge.prototype,"graphTypeName",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"hasM",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"hasZ",null),(0,i.Cg)([(0,p.MZ)({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],ge.prototype,"id",void 0),(0,i.Cg)([(0,p.MZ)({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],ge.prototype,"labelsVisible",void 0),(0,i.Cg)([(0,p.MZ)({type:[K.A],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:function(e,t,r){let i=[["ESRI__AGGREGATION_COUNT",R.M1],["ESRI__ORIGIN_ID",R.Cz],["ESRI__DESTINATION_ID",R.KQ],["ESRI__LAYOUT_GEOMETRY",R.T1]];try{for(let t of e)for(let[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(e){o.A.getLogger(this).warn("Error updating labelingInfo",e)}return V.w.call(this,e,t,r)},write:ce()}})],ge.prototype,"labelingInfo",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ge.prototype,"layerType",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(z.fV)))],ge.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(z.hG)))],ge.prototype,"maxScale",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(z.hn)))],ge.prototype,"minScale",void 0),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"objectIdField",void 0),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"objectType",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(z.ke)))],ge.prototype,"opacity",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(Z.ne)))],ge.prototype,"orderBy",void 0),(0,i.Cg)([(0,p.MZ)({clonable:!1})],ge.prototype,"parent",void 0),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"parentCompositeLayer",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(z.M6)))],ge.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,p.MZ)({type:n.A,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ge.prototype,"popupTemplate",void 0),(0,i.Cg)([(0,p.MZ)({type:Number,json:{write:{overridePolicy:fe}}})],ge.prototype,"refreshInterval",void 0),(0,i.Cg)([(0,p.MZ)({types:re.Hg,json:{name:"layerDefinition.drawingInfo.renderer",write:ce()}})],ge.prototype,"renderer",null),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"source",void 0),(0,i.Cg)([(0,p.MZ)()],ge.prototype,"spatialReference",null),(0,i.Cg)([(0,p.MZ)({type:H.A})],ge.prototype,"templates",null),(0,i.Cg)([(0,p.MZ)({type:J.A,json:{name:"layerDefinition.timeInfo",write:{overridePolicy:me},origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:me}},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:me}}}}})],ge.prototype,"timeInfo",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"dateFieldsTimeZone",null),(0,i.Cg)([(0,p.MZ)({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ge.prototype,"title",null),(0,i.Cg)([(0,ue.K)("title")],ge.prototype,"writeTitle",null),(0,i.Cg)([(0,p.MZ)({json:{read:!1}})],ge.prototype,"type",void 0),(0,i.Cg)([(0,p.MZ)(de((0,a.o8)(U.B)))],ge.prototype,"useViewTime",void 0),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"userHasEditingPrivileges",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"userHasFullEditingPrivileges",null),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],ge.prototype,"userHasUpdateItemPrivileges",null),(0,i.Cg)([(0,p.MZ)({type:Boolean,json:{name:"visibility",write:ce()}})],ge.prototype,"visible",void 0),ge=(0,i.Cg)([(0,p.$K)("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],ge);const be=ge},69860(e,t,r){r.d(t,{A:()=>o});var i=r(65864),n=r(90708),s=r(43334),a=r(15375);class o{constructor(){this._featureLookup=new Map}static getInstance(){return o.instance||=new o,o.instance}static resetInstance(){o.instance&&=null}deleteFromStore(e){e.forEach(e=>{this._featureLookup.delete(e)})}readFromStoreByList(e){let t=[];return e.forEach(e=>{let r=this.readFromStoreById(e);r&&t.push(r)}),t}readFromStoreById(e){return this._featureLookup.get(e)??null}writeToStore(e,t,r){let o=[];return e.forEach(e=>{if(!e?.id)return;e.properties||=[];let l=null;r&&e.properties[r]&&(l=(0,n.Ux)(e.properties[r])),"originId"in e&&"destinationId"in e&&(e.properties[a.Cz]=e.originId,e.properties[a.KQ]=e.destinationId),e.properties[t]=e.id;let p=e.properties;if(e.id){let t=this._featureLookup.get(e.id);if(t?.attributes){p={...t.attributes,...p};let e=r&&p[r];null!=e&&(p[r]=(0,i.rS)(e)),l??=t.geometry}}let u=new s.Om(l?.clone(),p,null,e.id);this._featureLookup.set(`${e.typeName?`${e.typeName}__${e.id}`:e.id}`,u),o.push(u)}),o}}},15375(e,t,r){r.d(t,["BL",0,"LC.ESRI__IsSpatial","Cz",0,"ESRI__OriginID","KQ",0,"ESRI__DestID","M1",0,"ESRI__AggregationCount","T1",0,"ESRI__LayoutGeometry","dr",0,"ESRI__ID"])},40736(e,t,r){r.d(t,{Gz:()=>U,O9:()=>Q,hZ:()=>q,CP:()=>Y,dD:()=>z,UT:()=>P,MY:()=>j,Td:()=>D,iW:()=>B,e$:()=>G,$L:()=>H,N1:()=>$,qN:()=>R});var i=r(68197),n=r(92602),s=r(70333),a=(r(49186),r(91869)),o=r(17676),l=r(78247),p=r(46737),u=r(21276),d=r(99917),h=r(16930),c=r(52039),y=r(99352),f=r(15375),m=r(29005),g=r(46499),b=r(73913),w=r(77548),M=r(80812),I=r(10407),C=r(53902),_=r(25927),T=r(32198),A=r(56372),v=r(91429);let E=class extends A.A{constructor(e){super(e),this.entityAdds=void 0,this.entityUpdates=void 0,this.entityDeletes=void 0,this.relationshipAdds=void 0,this.relationshipUpdates=void 0,this.relationshipDeletes=void 0,this.options=void 0}};(0,T.Cg)([(0,v.MZ)()],E.prototype,"entityAdds",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"entityUpdates",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"entityDeletes",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"relationshipAdds",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"relationshipUpdates",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"relationshipDeletes",void 0),(0,T.Cg)([(0,v.MZ)()],E.prototype,"options",void 0),E=(0,T.Cg)([(0,v.$K)("esri.rest.knowledgeGraph.GraphApplyEdits")],E);const S=E;var x=r(23150),k=r(94128),L=r(40863),N=r(68249);const F=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function R(e,t,r){return(async(e,t,r)=>{if(t||=[...e.layers,...e.tables].map(e=>e.graphTypeName),0===t?.length)return;let i=new Map;for(let r of t)i.set(r,F(e,r));let n=await(0,C.fetchClientDataAtKeys)(e.dataManager.knowledgeGraph,Array.from(i.values()),{requestOptions:{signal:r?.signal}});for(let t of[...e.layers,...e.tables]){let r=t.objectType.name;if(null==r)continue;let i=n.get(F(e,r));if(i){let e=JSON.parse(i);"object"==typeof e&&e&&!e.hasOwnProperty("showLabels")&&(e.showLabels=!1),t.read(e,{origin:"service"})}}})(e,t,r)}const O="#4a0932.#b31515.#18382e.#a64f1b.#102432.#8c213f.#ed9310.#2c6954.#144d59.#ffc730.#75351e.#454f4b.#78b1c2.#191921.#8f8f82.#9be0c0.#dbb658.#87b051.#11495c.#c43541.#9c5596.#44498b.#ad9d63.#86afb3.#5c98ca.#b0bfa2.#73241f.#b86b53.#d9d78c.#3e756d.#f260a1.#a0d17d.#c27c30.#eb82eb.#ffdf3c.#ffb259.#ab52b3.#3cccb4.#0095ba.#d92b30".split(".");function D(e){return e<0||e>=O.length?new i.A("#8f8f82"):new i.A(O[e])}function P(e){let t=e.toArray();return new L.A({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,style:"solid",width:.75,color:t},{type:"CIMVectorMarker",enable:!0,size:6,markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}]}]}}})}function j(e){let t="ESRI__ID",r=4;for(let i of e)if(i.name){if("name"===i.name.toLowerCase()){t=i.name;break}i.name.toLowerCase().includes("name")?(t=i.name,r=2):"esriFieldTypeString"===i.fieldType&&r>3&&(t=i.name,r=3)}return t}function B(e,t,r){let i={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},n=new g.A({labelExpressionInfo:new b.A({expression:"ESRI__ID"===r?`${t}`:`$feature.${r}`}),labelPlacement:"above-center",symbol:new N.A(i)}),s=new g.A({labelExpressionInfo:new b.A({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new N.A({...i,yoffset:"12px"})});return"entity"===e?[n]:[s]}function G(e,t,r){let i={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},n="ESRI__ID"===r?`${e}`:`$feature.${r}`;return"point"===t?[new g.A({labelExpressionInfo:new b.A({expression:n}),labelPlacement:"above-center",symbol:new N.A(i)})]:"polyline"===t?[new g.A({labelExpressionInfo:new b.A({expression:n}),labelPlacement:"center-along",repeatLabel:!0,symbol:new N.A(i)})]:"polygon"===t?[new g.A({labelExpressionInfo:new b.A({expression:n}),labelPlacement:"always-horizontal",symbol:new N.A(i)})]:null}async function $(e,t,r){return(async(e,t,r)=>{let i=!0,a=!1,o=!1;if(!n.A.userPrivilegesApplied)return{edit:i,fullEdit:a,updateItem:o};let l=await(0,w.wI)(t,r);if(!l||!s.id?.getCredential(`${l}/sharing`,{...r,prompt:!1}))return{edit:i,fullEdit:a,updateItem:o};let p=new M.default({id:e,portal:{url:l}});return await p.load(r),({features:{edit:i,fullEdit:a},content:{updateItem:o}}=(0,I.It)(p)),{edit:i,fullEdit:a,updateItem:o}})(e,t,r).catch(e=>((0,o.QP)(e),{edit:!0,fullEdit:!1,updateItem:!1}))}const Z={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function q(e){let{capabilities:t,allowGeometryUpdates:r,serviceCapabilities:{geometryCapabilities:{supportsZValues:i,supportsMValues:n}}}=e?.serviceDefinition||Z,s=e?.dataModel.arcgisManaged?t:t.filter(e=>"Query"===e),a=new Set(s);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:i},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:a.has("Create"),supportsDelete:a.has("Delete"),supportsEditing:a.has("Editing"),supportsChangeTracking:!1,supportsQuery:a.has("Query"),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:a.has("Update"),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:y.F,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:y.P,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&r,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:a.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:a.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function Q(e,t,r){let i=new S,n=t.graphTypeName,s=t.graphType,o="knowledge-graph"===r.type?t.geometryFieldName:null,l=!!t.fieldsIndex.get(o)?.editable,p=e=>{let r={...e};for(let e of t.fields)e.editable||delete r[e.name];for(let t of Object.keys(e))t.includes("ESRI__")&&delete r[t];return r},y=async e=>{await(0,d.initializeProjection)(e.spatialReference,h.A.WGS84);let t=(0,d.project)(e,h.A.WGS84);if("point"===t.type)return t.normalize();let[r]=await(0,c.el)(t);return r};for(let t of e.addFeatures??[]){let e=p(t.attributes);(0,w.UC)(t.sourceLayer)&&t.sourceLayer.graphTypeName===n&&("entity"===s?(i.entityAdds||=[],o&&t.geometry&&((0,u.f)(t.geometry),e[o]=await y(t.geometry)),i.entityAdds.push(new _.A({properties:e,typeName:n}))):(i.relationshipAdds||=[],i.relationshipAdds.push(new x.A({properties:e,typeName:n}))))}for(let t of e.updateFeatures??[]){let e=t.attributes[f.dr],r=p(t.attributes);(0,w.UC)(t.sourceLayer)&&t.sourceLayer.graphTypeName===n&&("entity"===s?(i.entityUpdates||=[],o&&l&&t.geometry&&((0,u.f)(t.geometry),r[o]=await y(t.geometry)),i.entityUpdates.push(new _.A({id:e,properties:r,typeName:n}))):(i.relationshipUpdates||=[],i.relationshipUpdates.push(new x.A({id:e,properties:r,typeName:n}))))}let m=new Map;for(let t of e.deleteFeatures??[])if((0,k.D)(t)){let e=t,r=(0,a.tE)(m,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===n&&r.ids.push(e.attributes[f.dr])}else t.objectId&&"string"==typeof t.objectId&&(0,a.tE)(m,n,()=>({typeName:n,ids:[]})).ids.push(t.objectId);for(let e of m.values())e.ids.length>0&&("entity"===s?(i.entityDeletes||=[],i.entityDeletes.push({typeName:e.typeName,ids:e.ids})):(i.relationshipDeletes||=[],i.relationshipDeletes.push({typeName:e.typeName,ids:e.ids})));return i}function U(e,t){let r={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(let i of e.editResults)if(i.typeName===t){for(let e of i.adds)r.addFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of i.updates)r.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of i.deletes)r.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return r}function z(e){if(!e.objectType)return null;let t=[];for(let r of e.fields)!r.name.includes("ESRI__")&&r.editable&&"geometry"!==r.type&&t.push(new p.A({fieldName:r.name}));return new l.A({elements:t})}function Y(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case"point":case"multipoint":t="point";break;case"polyline":t="line";break;case"polygon":t="polygon";break;default:t=null}return[new m.A({name:e.graphTypeName,drawingTool:t,prototype:{}})]}const H=e=>{let t="",r=e.split("/"),i=r.lastIndexOf("KnowledgeGraphServer");return i>0&&(t=r[i-1]),t}},99916(e,t,r){r.d(t,{Wq:()=>l,aq:()=>o}),r(52106);var i=r(49186),n=(r(86738),r(39829),r(82799),r(15795),r(69860),r(8460),r(69647)),s=r(53902),a=r(42538);async function o(e,t,r){let i=[],n=function(e,t){let r=new Map;if(t.dataModel?.relationshipTypes)for(let e of t.dataModel.relationshipTypes)e.name&&r.set(e.name,[]);for(let t of e)r.has(t.typeName)&&r.get(t.typeName)?.push(t.id);return r}(e,t),o={},l=[];for(let[e,t]of n){if(t.length<1)continue;let r=`${e}_ids`;o[r]=t,l.push(`MATCH (n)-[r:${e}]->(m) WHERE id(r) in $${r} RETURN id(n), labels(n)[0], id(m), labels(m)[0]`)}if(0===l.length)return[];let p=l.join(" UNION "),u=new a.A({openCypherQuery:p,bindParameters:o}),d=(await(0,s.executeQueryStreaming)(t,u,r?.requestOptions)).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await d.read();if(e)break;for(let e of t)i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}return i}function l(e){if(!e.spatialReference.isWGS84)throw new i.A("knowledge-graph:layer-support-utils","The utilsExtentToInBoundsRings function only supports WGS84 spatial references.");return e.clone().normalize().map(e=>[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]])}r(40863),r(94985),r(68249),r.d(t,["k5",0,e=>n.P_.get(e)??"radial-root-centric"])},82935(e,t,r){var i=r(32198),n=r(91429),s=r(30524),a=r(96184),o=r(73133),l=r(79677),p=r(10184),u=r(36005);const d={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation"}}};r.d(t,["B",0,d,"e",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){let r=t.timeInfo.exportOptions;if(!r)return null;let i=r.timeOffset,n=o.j.fromJSON(r.timeOffsetUnits);return i&&n?new p.A({value:i,unit:n}):null}get timeInfo(){return this._get("timeInfo")}set timeInfo(e){(0,s.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i.Cg)([(0,n.MZ)({type:l.A,json:{write:!1}})],r.prototype,"timeExtent",void 0),(0,i.Cg)([(0,n.MZ)({type:p.A})],r.prototype,"timeOffset",void 0),(0,i.Cg)([(0,u.w)("service","timeOffset",["timeInfo.exportOptions"])],r.prototype,"readOffset",null),(0,i.Cg)([(0,n.MZ)({value:null,type:a.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],r.prototype,"timeInfo",null),(0,i.Cg)([(0,n.MZ)(d)],r.prototype,"useViewTime",void 0),r=(0,i.Cg)([(0,n.$K)("esri.layers.mixins.TemporalLayer")],r),r}])},17036(e,t,r){r.d(t,{p:()=>l});var i=r(44208),n=r(53966),s=r(20437),a=r(95466),o=r(30524);function l(){return{fields:{type:[s.A],value:null,set:function(e){if(e&&(0,i.A)("big-integer-warning-enabled")){let t=e.filter(e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8);if(t.length){let e=t.map(e=>`'${e.name}'`).join(", ");n.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 ${2**53-1} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",e)}},fieldsIndex:{readOnly:!0,get(){return a.A.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){let e=this._userOutFields;if(!e?.length)return null;if(e.includes("*"))return["*"];if(!this.fields)return e;for(let t of e)this.fieldsIndex?.has(t)||n.A.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e});return(0,o.DB)(this.fieldsIndex,e)}}}}},8460(e,t,r){r.d(t,{$C:()=>f,Hh:()=>a,Tu:()=>c,Wg:()=>y,Xq:()=>g,i6:()=>b,pM:()=>d,vJ:()=>m});var i=r(2741);let n,s=null;function a(){return n||(n=r.e(3666).then(()=>r(3666)).then(({default:e})=>e({locateFile:e=>(0,i.s)(`esri/libs/linkchartlayout/${e}`)})).then(e=>{!function(e){s=e}(e)}),n)}const o={right:0,left:1,top:2,bottom:3},l={none:0,"start-only":1,"start-and-end":2};function p(e){let t={timeDirection:"right",timeBannerUTCOffsetInMinutes:0,eventsTicksVisualization:"start-and-end",showDurationLineForNonZeroDurationEntityEvents:!0,durationLineWidth:5,entityPositionAtDurationRatio:1,showNonZeroDurationIntervalBounds:!1,separateTimeOverlaps:!0,separateTimelineOverlaps:!0,moveFirstBends:!0,secondBendRatio:.3,lineSeparationMultiplier:1,spaceSeparatedLinesEvenly:!1,useBezierCurves:!1,separatedLineShapeRatio:0,...e?.toJSON(),eventsTicksVisualization:e?.eventsTicksVisualization??"start-and-end"};return{...t,timeDirection:{value:o[t.timeDirection]??o.right},eventsTicksVisualization:{value:l[t.eventsTicksVisualization]??l["start-and-end"]}}}function u(e,t,r,i,n,a){let o=r.length,l=n.length,p=Float64Array.BYTES_PER_ELEMENT,u=Uint32Array.BYTES_PER_ELEMENT,d=Uint8Array.BYTES_PER_ELEMENT,h=16+o*(d+2*p)+2*u*l,c=s._malloc(h);try{let d=c+16-c%16,h=d+o*p,y=h+o*p,f=y+l*u,m=f+l*u,g=()=>[s.HEAPF64.subarray(d>>3,(d>>3)+o),s.HEAPF64.subarray(h>>3,(h>>3)+o),s.HEAPU32.subarray(y>>2,(y>>2)+l),s.HEAPU32.subarray(f>>2,(f>>2)+l),s.HEAPU8.subarray(m,m+o)],[b,w,M,I,C]=g();b.set(r),w.set(i),M.set(n),I.set(a),C.set(t);let _=e(o,m,d,h,l,y,f),T=null,A=null;if(0===_.value){let e=s.getLayoutLinksTypes(),t=s.getLayoutLinksVerticesEndIndices(),r=s.getLayoutLinksVertices(),i=s.countLayoutLinksVertices();l&&(!e||!t)||i&&!r?_.value=1:(T={types:new Uint8Array(s.HEAPU8.subarray(e,e+l)),vertexEndIndex:new Uint32Array(s.HEAPU32.subarray(t>>2,(t>>2)+l)),vertices:new Float64Array(s.HEAPF64.subarray(r>>3,(r>>3)+2*i))},A=s.getAuxiliaryGraphicElements())}let[v,E,S,x,k]=g();return r.set(v),i.set(E),n.set(S),a.set(x),t.set(k),{status:_.value,links:T,graphics:A}}finally{s._free(c),s.cleanupLayout()}}var d,h,c,y,f,m,g,b;(h=d||={}).getMinIdealEdgeLength=function(){return s.getMinIdealEdgeLength()},h.apply=function(e,t,r,i,n,a,o=2,l=1,p=-1){return u((t,r,i,n,a,u,d)=>s.applyForceDirectedLayout(e,t,r,i,n,a,u,d,o,l,p),t,r,i,n,a)},function(e){e.apply=function(e,t,r,i,n,a,o=2,l=1,p=-1){return u((t,r,i,n,a,u,d)=>s.applyCommunityLayout(e,t,r,i,n,a,u,d,o,l,p),t,r,i,n,a)}}(c||={}),function(e){e.apply=function(e,t,r,i,n,a){return u((t,r,i,n,a,o,l)=>s.applySimpleLayout(e,t,r,i,n,a,o,l),t,r,i,n,a)}}(y||={}),function(e){e.apply=function(e,t,r,i,n,a){return u((t,r,i,n,a,o,l)=>s.applyHierarchicalLayout(e,t,r,i,n,a,o,l),t,r,i,n,a)}}(f||={}),function(e){e.apply=function(e,t,r,i,n,a){return u((t,r,i,n,a,o,l)=>s.applyRadialTreeLayout(e,t,r,i,n,a,o,l),t,r,i,n,a)}}(m||={}),function(e){e.apply=function(e,t,r,i,n,a){return u((t,r,i,n,a,o,l)=>s.applySmartTreeLayout(e,t,r,i,n,a,o,l),t,r,i,n,a)}}(g||={}),function(e){e.apply=function(e,t,r,i,n,a,o,l,d,h,c,y){return u((t,r,i,o,l,u,f)=>{if(n.length!==t||a.length!==t||d.length!==l||h.length!==l)return{value:1};let m=Float64Array.BYTES_PER_ELEMENT,g=s._malloc(16+t*m),b=s._malloc(16+t*m),w=s._malloc(16+l*m),M=s._malloc(16+l*m),I=g+16-g%16,C=b+16-b%16,_=w+16-w%16,T=M+16-M%16;try{return s.HEAPF64.subarray(I>>3,(I>>3)+t).set(n),s.HEAPF64.subarray(C>>3,(C>>3)+t).set(a),s.HEAPF64.subarray(_>>3,(_>>3)+l).set(d),s.HEAPF64.subarray(T>>3,(T>>3)+l).set(h),s.applyChronologicalLayout(e,t,r,i,o,I,C,l,u,f,_,T,c,p(y))}finally{s._free(g),s._free(b),s._free(w),s._free(M)}},t,r,i,o,l)}}(b||={})},69647(e,t,r){var i=r(66552);const n=(0,i.O)()({none:"none",startAndEnd:"start-and-end",startOnly:"start-only"}),s=(0,i.O)()({absoluteValue:"absolute-value",multiplier:"multiplier"}),a=new Map([["basic-grid","basic-grid"],["geographic-organic-standard","geographic-organic-standard"],["hierarchical-bottom-to-top","hierarchical-bottom-to-top"],["hierarchical-top-to-bottom","hierarchical-bottom-to-top"],["organic-community","organic-community"],["organic-fusiform","organic-standard"],["organic-leaf-circle","organic-standard"],["organic-standard","organic-standard"],["radial-node-centric","radial-root-centric"],["radial-root-centric","radial-root-centric"],["tree-bottom-to-top","tree-left-to-right"],["tree-left-to-right","tree-left-to-right"],["tree-right-to-left","tree-left-to-right"],["tree-top-to-bottom","tree-left-to-right"],["chronological-mono-timeline","chronological-mono-timeline"],["chronological-multi-timeline","chronological-multi-timeline"]]);r.d(t,["P_",0,a,"SJ",0,n,"lg",0,s])},54628(e,t,r){r.d(t,{lV:()=>s,zI:()=>n});var i=r(56507);async function n(e,t,r){if(!e||!t||!e.includes("/resources"))return!1;let n=t+"/resources",s=e.includes("/resources/")?e.split("/resources/",2)[1]:e;if(!s)return!1;let a=1;for(;-1!==a;){let e=(await(0,i.A)(n,{query:{f:"json",start:a,num:100}})).data,t=e?.resources??[];for(let e of t)if(e.resource===s)return"number"==typeof r&&e.created===r;if(null==e.nextStart||!t.length)break;a=e.nextStart}return!1}async function s(e,t){if(!e.length||!t)return new Map;let r=t+"/resources",n=1,s=new Map;for(;-1!==n;){let e=(await(0,i.A)(r,{query:{f:"json",start:n,num:100}})).data,t=e?.resources??[];for(let e of t)"number"==typeof e.created&&s.set(e.resource,e.created);if(null==e.nextStart||!t.length)break;n=e.nextStart}let a=new Map;for(let t of e){let e=t.includes("/resources/")?t.split("/resources/",2)[1]:t,r=s.get(e);null!=r&&a.set(t,r)}return a}r(49186),r(53966),r(17676),r(86738),r(8460)},25927(e,t,r){r.d(t,{A:()=>o});var i=r(32198),n=r(91429),s=r(86738),a=r(54238);let o=class extends a.A{constructor(e){super(e),this.layoutGeometry=null}};(0,i.Cg)([(0,n.MZ)({type:s.A,json:{write:!0}})],o.prototype,"layoutGeometry",void 0),o=(0,i.Cg)([(0,n.$K)("esri.rest.knowledgeGraph.Entity")],o)},54238(e,t,r){r.d(t,{A:()=>a});var i=r(32198),n=r(91429),s=r(77901);let a=class extends s.A{constructor(e){super(e),this.typeName=null,this.id=null}};(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],a.prototype,"typeName",void 0),(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],a.prototype,"id",void 0),a=(0,i.Cg)([(0,n.$K)("esri.rest.knowledgeGraph.GraphNamedObject")],a)},77901(e,t,r){r.d(t,{A:()=>a});var i=r(32198),n=r(25482),s=r(91429);let a=class extends n.o{constructor(e){super(e),this.properties={}}};(0,i.Cg)([(0,s.MZ)({json:{write:!0}})],a.prototype,"properties",void 0),a=(0,i.Cg)([(0,s.$K)("esri.rest.knowledgeGraph.GraphObject")],a)},42538(e,t,r){r.d(t,{A:()=>l});var i=r(32198),n=r(91429),s=r(16930),a=r(56372);let o=class extends a.A{constructor(e){super(e),this.openCypherQuery=""}};(0,i.Cg)([(0,n.MZ)()],o.prototype,"openCypherQuery",void 0),o=(0,i.Cg)([(0,n.$K)("esri.rest.knowledgeGraph.GraphQuery")],o);let l=class extends o{constructor(e){super(e),this.bindParameters=null,this.bindGeometryQuantizationParameters=null,this.outputQuantizationParameters=null,this.outputSpatialReference=null,this.provenanceBehavior=null}};(0,i.Cg)([(0,n.MZ)()],l.prototype,"bindParameters",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"bindGeometryQuantizationParameters",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"outputQuantizationParameters",void 0),(0,i.Cg)([(0,n.MZ)({type:s.A})],l.prototype,"outputSpatialReference",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"provenanceBehavior",void 0),l=(0,i.Cg)([(0,n.$K)("esri.rest.knowledgeGraph.GraphQueryStreaming")],l)},40662(e,t,r){r.d(t,{A:()=>l});var i=r(32198),n=r(4718),s=r(91429),a=r(77901),o=r(43937);let l=class extends a.A{constructor(e){super(e)}writeProperties(e,t,r,i){t[r]=p(e,i)}};function p(e,t){return e&&"function"==typeof e.write?e.write({},t):e&&"function"==typeof e.toJSON?e.toJSON(t):Array.isArray(e)?e.map(e=>p(e,t)):(0,n.Qd)(e)?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,p(r,t)])):e}(0,i.Cg)([(0,o.K)("properties")],l.prototype,"writeProperties",null),l=(0,i.Cg)([(0,s.$K)("esri.rest.knowledgeGraph.ObjectValue")],l)},42095(e,t,r){r.d(t,{A:()=>o});var i=r(32198),n=r(25482),s=r(91429),a=r(77901);let o=class extends n.o{constructor(e){super(e),this.path=[]}};(0,i.Cg)([(0,s.MZ)({type:[a.A],json:{write:!0}})],o.prototype,"path",void 0),o=(0,i.Cg)([(0,s.$K)("esri.rest.knowledgeGraph.Path")],o)},23150(e,t,r){r.d(t,{A:()=>o});var i=r(32198),n=r(91429),s=r(82799),a=r(54238);let o=class extends a.A{constructor(e){super(e),this.originId=null,this.destinationId=null,this.layoutGeometry=null}};(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],o.prototype,"originId",void 0),(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],o.prototype,"destinationId",void 0),(0,i.Cg)([(0,n.MZ)({type:s.A,json:{write:!0}})],o.prototype,"layoutGeometry",void 0),o=(0,i.Cg)([(0,n.$K)("esri.rest.knowledgeGraph.Relationship")],o)},2272(e,t,r){r.d(t,{Dl:()=>p,gf:()=>d,jV:()=>l,lF:()=>u});var i=r(92602),n=r(70333),s=r(4718),a=r(84952),o=r(926);function l(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function p(e){return"string"==typeof e?(0,a.An)(e):(0,s.o8)(e)}function u(e,t,r){let i={};for(let n in e){if("declaredClass"===n)continue;let s=e[n];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))i[n]=s.map(e=>u(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(r?.[n]);i[n]=t?e:JSON.stringify(e)}else i[n]=t?s:JSON.stringify(s);else i[n]=s}return i}async function d(e,t,s){return function(e,t){return e?t&&(0,o.Qc)(e)?t:(0,o.getApiKey)(e)??n.id?.findCredential(e)?.token:null}(e,t)||(!n.id&&i.A.request.useIdentity&&await Promise.all([r.e(8673),r.e(7956),r.e(4189)]).then(()=>r(98232)),(await n.id.getCredential(e,s))?.token)}},62046(e,t,r){r.d(t,{Fe:()=>y,KU:()=>b,Nk:()=>p,X5:()=>s});var i=r(68197),n=r(93397);function s(e,t,r){if(!e)return;let i=(0,n.lW)(e),s=function(e){let t=(0,n.lW)(e);if("CIMTextSymbol"===t?.type)return t.height??0;let r=0;if(t?.symbolLayers)for(let e of t.symbolLayers)(0,n.MM)(e)&&null!=e.size&&e.size>r?r=e.size:(0,n.mA)(e)&&null!=e.width&&e.width>r?r=e.width:(0,n.jn)(e);return r}(e);0===s?function(e,t){if(e)if("CIMTextSymbol"===e.type)e.height=t;else if(e.symbolLayers)for(let r of e.symbolLayers)switch(r.type){case"CIMPictureMarker":case"CIMVectorMarker":r.size=t;break;case"CIMPictureStroke":case"CIMSolidStroke":case"CIMGradientStroke":r.width=t}}(i,t):a(i,t/s,!1,r)}function a(e,t,r,i){if(e)if("CIMTextSymbol"===e.type)null!=e.height&&(e.height*=t);else{if(r&&e.effects)for(let r of e.effects)l(r,t);if(e.symbolLayers)for(let r of e.symbolLayers){switch(r.type){case"CIMPictureMarker":case"CIMVectorMarker":o(r,t,i);break;case"CIMPictureStroke":case"CIMSolidStroke":case"CIMGradientStroke":!i?.preserveOutlineWidth&&r.width&&(r.width*=t);break;case"CIMPictureFill":r.height&&(r.height*=t),r.offsetX&&(r.offsetX*=t),r.offsetY&&(r.offsetY*=t);break;case"CIMHatchFill":a(r.lineSymbol,t,!0,{...i,preserveOutlineWidth:!1}),r.offsetX&&(r.offsetX*=t),r.offsetY&&(r.offsetY*=t),r.separation&&(r.separation*=t)}if(r.effects)for(let e of r.effects)l(e,t)}}}function o(e,t,r){if(e&&(e.markerPlacement&&function(e,t){switch((0,n.zr)(e)&&e.offset&&(e.offset*=t),e.type){case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineSameSize":e.customEndingOffset&&(e.customEndingOffset*=t),e.offsetAlongLine&&(e.offsetAlongLine*=t),e.placementTemplate&&e.placementTemplate.length&&(e.placementTemplate=e.placementTemplate.map(e=>e*t));break;case"CIMMarkerPlacementAlongLineVariableSize":e.maxRandomOffset&&(e.maxRandomOffset*=t),e.placementTemplate&&e.placementTemplate.length&&(e.placementTemplate=e.placementTemplate.map(e=>e*t));break;case"CIMMarkerPlacementOnLine":e.startPointOffset&&(e.startPointOffset*=t);break;case"CIMMarkerPlacementAtExtremities":e.offsetAlongLine&&(e.offsetAlongLine*=t);break;case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementOnVertices":break;case"CIMMarkerPlacementAtRatioPositions":e.beginPosition&&(e.beginPosition*=t),e.endPosition&&(e.endPosition*=t);break;case"CIMMarkerPlacementPolygonCenter":e.offsetX&&(e.offsetX*=t),e.offsetY&&(e.offsetY*=t);break;case"CIMMarkerPlacementInsidePolygon":e.offsetX&&(e.offsetX*=t),e.offsetY&&(e.offsetY*=t),e.stepX&&(e.stepX*=t),e.stepY&&(e.stepY*=t)}}(e.markerPlacement,t),e.offsetX&&(e.offsetX*=t),e.offsetY&&(e.offsetY*=t),e.anchorPoint&&"Absolute"===e.anchorPointUnits&&(e.anchorPoint={x:e.anchorPoint.x*t,y:e.anchorPoint.y*t}),e.size=null==e.size?0:e.size*t,"CIMVectorMarker"===e.type&&e.markerGraphics))for(let i of e.markerGraphics)e.scaleSymbolsProportionally||a(i.symbol,t,!0,r)}function l(e,t){if(!(0,n.Kq)(e))switch(e.type){case"CIMGeometricEffectArrow":case"CIMGeometricEffectDonut":e.width&&(e.width*=t);break;case"CIMGeometricEffectBuffer":e.size&&(e.size*=t);break;case"CIMGeometricEffectCut":e.beginCut&&(e.beginCut*=t),e.endCut&&(e.endCut*=t),e.middleCut&&(e.middleCut*=t);break;case"CIMGeometricEffectDashes":e.customEndingOffset&&(e.customEndingOffset*=t),e.offsetAlongLine&&(e.offsetAlongLine*=t),e.dashTemplate&&e.dashTemplate.length&&(e.dashTemplate=e.dashTemplate.map(e=>e*t));break;case"CIMGeometricEffectExtension":case"CIMGeometricEffectJog":case"CIMGeometricEffectRadial":e.length&&(e.length*=t);break;case"CIMGeometricEffectMove":e.offsetX&&(e.offsetX*=t),e.offsetY&&(e.offsetY*=t);break;case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":e.offset&&(e.offset*=t);break;case"CIMGeometricEffectRegularPolygon":e.radius&&(e.radius*=t);break;case"CIMGeometricEffectTaperedPolygon":e.fromWidth&&(e.fromWidth*=t),e.length&&(e.length*=t),e.toWidth&&(e.toWidth*=t);break;case"CIMGeometricEffectWave":e.amplitude&&(e.amplitude*=t),e.period&&(e.period*=t)}}function p(e){let t=[];return u((0,n.lW)(e),t),t.length?new i.A((0,n.e6)(t[0])):null}function u(e,t){if(!e)return;let r;r="CIMTextSymbol"===e.type?e.symbol:e;let i="CIMPolygonSymbol"===e.type;if(r?.symbolLayers)for(let e of r.symbolLayers)if(!(e.colorLocked||i&&((0,n.mA)(e)||(0,n.MM)(e)&&e.markerPlacement&&(0,n.zr)(e.markerPlacement))))switch(e.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":e.tintColor&&d(t,e.tintColor);break;case"CIMVectorMarker":e.markerGraphics?.forEach(e=>{u(e.symbol,t)});break;case"CIMSolidStroke":case"CIMSolidFill":d(t,e.color);break;case"CIMGradientFill":h(t,e);break;case"CIMHatchFill":u(e.lineSymbol,t)}}function d(e,t){for(let r of e)if(r.join(".")===t.join("."))return;e.push(t)}function h(e,t){switch(t.colorRamp?.type){case"CIMMultipartColorRamp":t.colorRamp.colorRamps?.forEach(t=>{"CIMLinearContinuousColorRamp"===t.type&&c(e,t)});break;case"CIMLinearContinuousColorRamp":case"CIMPolarContinuousColorRamp":c(e,t.colorRamp)}}function c(e,t){t&&(t.fromColor&&d(e,t.fromColor),t.toColor&&d(e,t.toColor))}function y(e,t,r){t instanceof i.A||(t=new i.A(t));let s=(0,n.lW)(e);s&&f(s,t,r)}function f(e,t,r){if(!e)return;let i;i="CIMTextSymbol"===e.type?e.symbol:e;let s="CIMPolygonSymbol"===i?.type;if(i?.symbolLayers)for(let e of i.symbolLayers){if(e.colorLocked)continue;if(s)if(r){let{layersToColor:t}=r;if(((0,n.mA)(e)||(0,n.MM)(e)&&e.markerPlacement&&(0,n.zr)(e.markerPlacement))&&"fill"===t||(0,n.jn)(e)&&"outline"===t)continue}else if((0,n.mA)(e)||(0,n.MM)(e)&&e.markerPlacement&&(0,n.zr)(e.markerPlacement))continue;let i=t.toArray();switch(e.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":e.tintColor=i;break;case"CIMVectorMarker":e.markerGraphics?.forEach(e=>{f(e.symbol,t,r)});break;case"CIMSolidStroke":case"CIMSolidFill":e.color=i;break;case"CIMGradientFill":m(e,t);break;case"CIMHatchFill":f(e.lineSymbol,t,r)}}}function m(e,t){switch(e.colorRamp?.type){case"CIMMultipartColorRamp":e.colorRamp.colorRamps?.forEach(e=>{"CIMLinearContinuousColorRamp"===e.type&&g(e,t)});break;case"CIMLinearContinuousColorRamp":case"CIMPolarContinuousColorRamp":g(e.colorRamp,t)}}function g(e,t){if(e&&(e.fromColor&&=t.toArray(),e.toColor)){let r=t.clone();r.a=0,e.toColor=r.toArray()}}function b(e,t,r=!1){let i=(0,n.lW)(e);if(r&&(t=360-t),"CIMTextSymbol"===i?.type)i.angle=t;else if("CIMPointSymbol"===i?.type&&i.symbolLayers){let e=t-(i.angle||0);for(let t of i.symbolLayers)if((0,n.MM)(t)){let r=t.rotation||0;t.rotateClockwise?r-=e:r+=e,t.rotation=r}i.angle=t}}},37531(e,t,r){r.d(t,{dt:()=>h,GG:()=>g,UQ:()=>m,Sx:()=>u});var i=r(68197),n=r(60999),s=(r(90629),r(51850)),a=(r(76369),r(62046)),o=(r(2741),r(56507),r(66344));new Map([["dash",[4,3]],["dashdot",[4,3,1,3]],["dot",[1,3]],["longdash",[8,3]],["longdashdot",[8,3,1,3]],["longdashdotdot",[8,3,1,3,1,3]],["shortdash",[4,1]],["shortdashdot",[4,1,1,1]],["shortdashdotdot",[4,1,1,1,1,1]],["shortdot",[1,1]],["solid",[]]]),new o.q(1e3),new i.A([128,128,128]);var l=r(28975),p=r(33910);function u(e,t){if(!e)return null;let r=null;return(0,p.wk)(e)?r=function(e){let t=e.symbolLayers;if(!t)return null;let r=null;return t.forEach(e=>{"object"===e.type&&e.resource?.href||(r="water"===e.type?e.color:e.material?e.material.color:null)}),r?new i.A(r):null}(e):(0,p.$y)(e)&&(r="cim"===e.type?(0,a.Nk)(e):e.color?new i.A(e.color):null),r?d(r,t):null}function d(e,t){if(null==t||null==e)return e;let r=e.toRgba();return r[3]*=t,new i.A(r)}function h(e,t,r){e&&(t||null!=r)&&(t&&=new i.A(t),(0,p.wk)(e)?function(e,t,r){let n=e.symbolLayers;if(!n)return;let s=(e,n=!1)=>{let s=t??e??null;return null!=r?.override&&(!s&&n&&(s=new i.A([255,255,255])),s&&(s.a=r.override)),d(s,r?.add)};n.forEach(e=>{if("water"===e.type)return void(e.color=d(e.color,r?.add));let t=null==e.material?null:e.material.color,i=s(t,"icon"===e.type&&null!=e.resource?.href);null==e.material?e.material=new l.A({color:i}):e.material.color=i,"outline"in e&&e.outline?.color&&null!=r?.add&&(e.outline.color=d(e.outline.color,r.add)),"marker"in e&&null!=e.marker&&(e.marker.color=s(e.marker.color))})}(e,t,r):(0,p.$y)(e)&&function(e,t,r){t??=e.color,null!=r?.override&&t&&(t.a=r.override),t&&(e.color=d(t,r?.add)),"outline"in e&&e.outline?.color&&(e.outline.color=d(e.outline.color,r?.add))}(e,t,r))}function c(e){for(let t of e)if("number"==typeof t)return t;return null}function y(e,t,r){for(let i=0;i<3;i++){let n=e[i];switch(n){case"symbol-value":{let e=r[i];return null==e?1:e/t[i]}case"proportional":break;default:if(null!=n&&t[i])return n/t[i]}}return null}function f(e,t,r,i){switch(e){case"proportional":return r*i;case"symbol-value":return t??r;default:return e}}async function m(e,t){if(e&&t){if((0,p.wk)(e))return async function(e,t){let i=e.symbolLayers;i&&await(0,n.jJ)(i,async e=>async function(e,t){switch(e.type){case"extrude":!function(e,t){let r=t[2];"number"==typeof r&&(e.size=r)}(e,t);break;case"icon":case"line":case"text":!function(e,t){let r=c(t);null!=r&&(e.size=r)}(e,t);break;case"path":!function(e,t){let r=y(t,s.Un,[e.width,void 0,e.height]);null!=r&&(e.width=f(t[0],e.width,1,r),e.height=f(t[2],e.height,1,r))}(e,t);break;case"object":await async function(e,t){let{resourceSize:i,symbolSize:n}=await async function(e){let{computeObjectLayerResourceSize:t}=await r.e(5404).then(()=>r(95404)),i=await t(e,10),{width:n,height:s,depth:a}=e,o=[n,a,s],l=1;for(let e=0;e<3;e++){let t=o[e];if(null!=t){l=t/i[e];break}}for(let e=0;e<3;e++)o[e]??(o[e]=i[e]*l);return{resourceSize:i,symbolSize:o}}(e),s=y(t,i,n);null!=s&&(e.width=f(t[0],n[0],i[0],s),e.depth=f(t[1],n[1],i[1],s),e.height=f(t[2],n[2],i[2],s))}(e,t)}}(e,t))}(e,t);(0,p.$y)(e)&&function(e,t){let r=c(t);if(null!=r)switch(e.type){case"simple-marker":e.size=r;break;case"picture-marker":{let t=e.width/e.height;t>1?(e.width=r,e.height=r*t):(e.width=r*t,e.height=r);break}case"simple-line":e.width=r;break;case"text":e.font.size=r;break;case"simple-fill":case"picture-fill":break;case"cim":(0,a.X5)(e,r,{preserveOutlineWidth:!1})}}(e,t)}}function g(e,t,r){if(e&&null!=t)if((0,p.wk)(e)){let i=e.symbolLayers;i&&i.forEach(e=>{if("object"===e.type)switch(r){case"tilt":e.tilt=(e.tilt??0)+t;break;case"roll":e.roll=(e.roll??0)+t;break;default:e.heading=(e.heading??0)+t}"icon"===e.type&&(e.angle+=t)})}else if((0,p.$y)(e))switch(e.type){case"simple-marker":case"picture-marker":case"text":e.angle+=t;break;case"cim":(0,a.KU)(e,t,!0)}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(Array.isArray(self.webpackChunkRemoteClient)?self.webpackChunkRemoteClient:self.webpackChunkRemoteClient=[]).push([[6051],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...n){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(n,r)||(i=e.apply(this,n),t=this,r=n,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{JY:()=>d,Qf:()=>o,Qh:()=>s,lM:()=>n,ro:()=>u,rq:()=>f});var r=i(44208),a=i(34275);function n(e){if(!e)return 0;let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return o(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return f(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?s(e):h;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...e){return e.reduce((e,t)=>e+u(t),0)}function u(e,t=16){return e?(0,a.iu)(e)?e.byteLength+p:Array.isArray(e)?f(e,t):0:0}function f(e,t){return c+e.length*t}const h=32,c=16,d=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,p=145},5359(e,t,i){i.d(t,{H:()=>r,Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}},16051(e,t,i){i.r(t),i.d(t,{default:()=>bt});var r,a=i(32198),n=i(40124),s=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),d=i(91429),p=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),A=i(63074),S=i(69208),C=i(34287),_=i(8303),R=i(72545),M=i(56551),T=i(54310),O=i(25036),k=i(82935),F=i(82806),D=i(7548),N=i(23636),P=i(49859),z=i(68197),L=i(5443),E=i(16930),B=i(73444),$=i(94778),J=i(14140);function U(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function H(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function j(e){let t=(0,B.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function Z(){return Math.round(255*Math.random())}function V(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:n,categoryEncoding:s,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=j(a)),n&&(t[e].unit=n.label?j(n.label):null,t[e].symbol=n.symbol?.value),s)){let i=Object.entries(s).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?j(e.label):null,e.preferredColor)){let t=z.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=Z(),e.Green=Z(),e.Blue=Z())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function q(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,$.X1)(t,i)}function W(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),n=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),s=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);s+=n[l]*(i%t[a]),i=Math.floor(i/t[a])}return s}var G=i(4366),X=i(47520),Y=i(51927),K=i(45617),Q=i(87186);let ee=class extends P.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,n=this._pixelBlockTiles.get(a);if(n)return n;if(!this.source)return null;let{rasterInfo:s}=this,[l,o]=s.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let n=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return n&&this._pixelBlockTiles.set(a,n),n}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let d={pixelBlock:c,useBilinear:"thematic"!==s.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(d,r):(0,X.J$)(d)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:n,nativeExtent:s,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:d}=f??t.imageInfo,p=t.extent??new L.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new E.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:p.width/h,y:p.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:d,extent:p,nativeExtent:s,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:p.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:n});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,n="thematic"!==r.dataType,s=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:n},i):Promise.resolve((0,X.lD)(e,t,a,n)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,Y.f4)(e)),c=await(0,h.Lx)([s,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let n=a.dimensions.map(e=>new K.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),s=(0,G.NG)(n,t),l=null==s?null:e[s];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,Y.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,d.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,d.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,d.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends P.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:n}=await this._fetchData(e),{statistics:s,histograms:l}=(0,Y.eH)(i[0]),o=n?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:s,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:n,values:s}=r[e];if(!("ndarray"===n.toLowerCase()&&s?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!U(t[t.length-1])||!H(t[t.length-2]))throw new l.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],n=-1,s=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];U(o)?n=e:H(o)&&(s=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,n=(t-e)/(i-1);r.push([e-.5*n,t+.5*n]),a.push(n);for(let t=0;t<i;t++)f.push(e+n*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}n>-1&&-1===s?s=+(0===n):s>-1&&-1===n?n=+(0===s):-1===s&&-1===n&&(n=0,s=1),l=l.filter((e,t)=>t!==n&&t!==s);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[n])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new E.A({wkid:h}),[d,p]=r[n],[m,g]=r[s],y=new L.A({xmin:d,xmax:p,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[n]),height:Math.round(y.height/a[s]),extent:y,dimensions:l}}(e),{ranges:n}=e,s=Object.keys(n).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<s.length;e++){let t=s[e];a?.length&&l.push({name:t,dimensions:a})}let o=V(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<s.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=n[s[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),d=u.slice(0,-2),p="float"===l?"f32":q(r),m=t*i,g=r.length/m;for(let n=0;n<g;n++){let s=J.A.createEmptyBand(p,m),l=new Uint8Array(m).fill(255),o=!1,u=n*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):s[e]=t}if(0===e||a?.length){let e=new J.A({width:t,height:i,mask:o?l:null,pixels:[s],pixelType:p});e.updateStatistics(),a?.length?f[W(c,d,n)+h]=e:f.push(e)}else{let e=f[n];e.pixels.push(s),o?e.mask&&=J.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:s}}(t)}};(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,d.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var ne=i(4576),se=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,se.jp)(e))return new E.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),n=a>-1?a:i.indexOf("GEOGCS");if(-1===n)return null;let s=e.slice(n,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(s);let o=t?new E.A({wkid:t}):new E.A({wkt:s}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new E.A({wkt:e}):new E.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),n=(0,le.Ui)(t,"CoeffY/Double"),s=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,n),u=ue(s,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,n=(0,le.v7)(e,"NoDataValue"),s=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(s,"HistMin"),o=(0,le.v7)(s,"HistMax"),u=(0,le.v7)(s,"BucketCount"),f=(0,le.mX)(s,"HistCounts")?.split("|").map(e=>Number(e));(0,le.IC)(e,"Metadata/MDI").forEach(e=>{let n=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=n;break;case"STATISTICS_MAXIMUM":i=n;break;case"STATISTICS_MEAN":r=n;break;case"STATISTICS_STDDEV":a=n}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:n,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(ne.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(ne.Ru):null),t}var de=i(85951),pe=i(40951);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends P.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,n="immediate"===a||"jpg"!==r;if(n){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,de.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:s,ioConfig:o}=this,u=new te({preGenerateTiles:n,rasterJobHandler:s,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:n}=await this._fetchAuxiliaryData(t),s=!i;s&&(i=new E.A({wkid:3857})),a?.length&&null==r&&(r=(0,Y.Pg)(a));let{width:l,height:o}=e,u=new L.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=n?n.forwardTransform(u):u,h=!0;if(n){let e=n.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(n=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:n,statistics:r,histograms:a,isPseudoSpatialReference:s,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,pe.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),n=this.datasetFormat,s="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,l=r||null==s||i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,d.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(20223),Ie=i(87045),Ae=i(25943),Se=i(82371);let Ce=class extends P.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:n}=this.rasterInfo,{transposeInfo:s}=a,l=null!=s&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let n=0;for(let{data:e}of t)u.push(n),a.set(new Uint8Array(e),n),n+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:d}=a,p=l?s.tileSize:d.size,m=/^(mixed|jp)/i.test(d.format),g="raw"===d.format,y=await this.decodePixelBlock(o,{format:g?"bsq":void 0,width:p[0],height:p[1],planes:u?.length,offsets:u,pixelType:g?this.rasterInfo.pixelType:void 0,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==y)return null;let w=a.blockBoundary[e];if("jpg"!==a.compression||i>w.minCol&&i<w.maxCol&&t>w.minRow&&t<w.maxRow)return y;let{origin:v,blockWidth:x,blockHeight:b}=a,{x:I,y:A}=this.getPyramidPixelSize(e),S=Math.round((n.xmin-v.x)/I)%x,C=Math.round((n.xmax-v.x)/I)%x||x,_=Math.round((v.y-n.ymax)/A)%b,R=Math.round((v.y-n.ymin)/A)%b||b,M=i===w.minCol?S:0,T=t===w.minRow?_:0,O=i===w.maxCol?C:x,k=t===w.maxRow?R:b;return(0,X.z$)(y,{x:M,y:T},{width:O-M,height:k-T}),y}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let i=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,n=a-r+this._levelOffset,s=i.srcLocation;for(;n>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(n,i.row,i.col,t))break}catch{}if(n--,r++,i=this.identifyPixelLocation(s,r,t.datumTransformation),null===i)return null}return-1===n||null==i?null:r}async _open(e){let t=e?.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let r=i.data;if(this.sourceJSON=r,!r)throw new l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Se.E9)(a,r);let n="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:n}=t;if(null!=a&&null!=n)return Ie.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=n)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,n=r?t(r):-1/0;return Ie.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=n})})}return Ie.A.fromJSON(e)}(r.tileInfo,r):Ie.A.fromJSON(r.tileInfo);(0,u.Lw)(n);let[s,o]=this._computeMinMaxLOD(a,n),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(s.resolution-h.x)>c)&&(h.x=h.y=s.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let d=s.level-o.level,[p,m]=n.size,g=[],y=[],{lods:w}=n;w.forEach((e,t)=>{e.level>=o.level&&e.level<=s.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,p,m,n.origin,g,d),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/s.resolution)**(-1/d))/10,A=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new be.A({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:n,isBsqTile:A,transposeInfo:v,blockBoundary:x}),(0,D.vj)(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Ae.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=E.A.fromJSON(t.spatialReference||e.spatialReference),n=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:L.A.fromJSON(e),spatialReference:a,pixelSize:n,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Se.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,n=await Promise.all([r,a]);return this._slices=n[1],n[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,n=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),s=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[n,s];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??n,s];let{minScale:o,maxScale:u}=this.sourceJSON,f=n;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??n);let h=s;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??s,this._levelOffset=h.level-s.level),[f,h]}};(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],Ce.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,d.MZ)()],Ce.prototype,"tileType",void 0),Ce=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.ImageServerRaster")],Ce);const _e=Ce;var Re=i(10713);const Me=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Te=new Map;Te.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Te.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Te.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Te.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Te.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Oe=class extends P.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:n,blockBoundary:s}=this.rasterInfo.storageInfo,l=s[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*n);return new J.A({width:a,height:n,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<p;g++)(!d||d.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<p;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Te.get(this.rasterInfo.storageInfo.compression).decoderFormat,A="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:n,format:I,planes:d?.length||o,offsets:x,pixelType:u,canvasUsage:A?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:C}=this.rasterInfo;if(null!=C&&"lerc"!==I&&!S.mask&&(C=C[0],null!=C)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(C)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-C)/C)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==C&&(t[g]=1);S.mask=t}let _=0,R=0;if(h!==a||c!==n){let e=S.mask;if(e)for(g=0;g<n;g++)if(R=g*a,g<c)for(_=h;_<a;_++)e[R+_]=0;else for(_=0;_<a;_++)e[R+_]=0;else for(e=new Uint8Array(a*n),S.mask=e,g=0;g<c;g++)for(R=g*a,_=0;_<h;_++)e[R+_]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:n,skipExtensions:s=[]}=this.ioConfig;if(!s.includes("aux.xml")&&!n){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,Y.Pg)(t.histograms)))}n&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(Re.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,d=[],p=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*p*4,d.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=d,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,n,{blockWidth:s,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,d=0;for(n=0;n<e;n++)d=o**n,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=r*a;d=o**e,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=t*r+i,c*=4*h;let p=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=p[4*e]*2**32+p[4*e+1],g=m+p[4*e+2]*2**32+p[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?s:Math.ceil(u/d)-s*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/d)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),n=parseInt(i.getAttribute("c"),10),s=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Te.has(s))throw new l.A("mrf:open","currently does not support compression "+s);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Me.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),d=f.getAttribute("c"),p=d?d===String(n):Te.get(s).isOneSegment;this._isBsq=!p;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",n=E.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(n=new E.A({wkid:e}))}else n=fe(a)??E.A.WGS84;else x=!0,n=new E.A({wkid:3857});y=new L.A({xmin:e,ymin:t,xmax:i,ymax:r}),y.spatialReference=n}else x=!0,y=new L.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),A=y.spatialReference,S=new be.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:A}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:s,pyramidScalingFactor:I}),C=new xe.A({x:y.width/r,y:y.height/a,spatialReference:A}),_=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:A,bandCount:n,pixelType:u,pixelSize:C,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,le.mX)(t,"DataFile")),M=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:M||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Te.get(s).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}};(0,a.Cg)([(0,d.MZ)()],Oe.prototype,"_files",void 0),(0,a.Cg)([(0,d.MZ)()],Oe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,d.MZ)()],Oe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],Oe.prototype,"datasetFormat",void 0),Oe=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.MRFRaster")],Oe);const ke=Oe;i(44208);var Fe=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),n=a.map(e=>e.name),s=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<n.length;o++)t[n[o]]=e[o-1];s.push({attributes:t})}),{displayFieldName:"",fields:a,features:s}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),n=t.getUint16(10,!0),s={version:i,recordCount:r,headerByteCount:a,recordByteCount:n},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,Fe.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>n;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,Fe.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=n}return{header:s,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Pe=i(44094),ze=i(94213);const Le="none-tiled tiff is not optimized for access, convert to COG and retry.";let Ee=class extends P.A{constructor(){super(...arguments),this._bufferSize=1048576,this._chunkSize=10485760,this._fileSize=-1,this._headerChunks=[],this.datasetFormat="TIFF",this.headerInfo=null}async fetchRawTile(e,t,i,r={}){if(!this.headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this.headerInfo.hasMaskBand){let n=await this._fetchRawTiffTile(e,t,i,!0,r);null!=n&&n.pixels[0]instanceof Uint8Array&&(a.mask=n.pixels[0])}return a}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf(".")),await this._readHeader(e?.signal),await this._fetchAllAuxData(),this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(this.rasterInfo),this.updateTileInfo()}async _readHeader(e){try{let t=await this._fetchHeaderData(0,this._bufferSize,e);if(!t)throw new l.A("tiffraster:open","failed to open url "+this.url);let{littleEndian:i,firstIFDPos:r,isBigTiff:a}=(0,Pe.uT)(t),n=[],s={fileChunk:t,posIFD:r,fileOffset:0};await this._readIFDs(n,s,i,a?8:4,e);let{imageInfo:o,rasterInfo:u}=function(e){let t=(0,Pe.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:n,planes:s,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:d,tileBoundary:p,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new E.A({wkid:3857}));let x=new L.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new be.A({blockWidth:a,blockHeight:n,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:d,blockBoundary:p}),A=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},C=new Q.A({width:i,height:r,bandCount:s,pixelType:l,pixelSize:A,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(C.nativeExtent=new L.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),C.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),C.extent=C.transform.forwardTransform(C.nativeExtent),C.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),d){let{x:e,y:t}=C.pixelSize;d.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:C}}(n),f=(0,Pe.zS)(n),h=(0,Pe.r9)(n);this.headerInfo={littleEndian:i,isBigTiff:a,ifds:n,pyramidIFDs:f,maskIFDs:h,...o},this._set("rasterInfo",u),this._validateHeader()}finally{this._headerChunks.length=0}}_validateHeader(){let e=this.headerInfo;if(!e.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+e.message);if(!e.tileWidth||!e.tileHeight)throw new l.A("tiffraster:open",Le);this.rasterInfo.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let t=e.ifds[0],i=t.get("PREDICTOR")?.values?.[0];if(3===t.get("SAMPLEFORMAT")?.values?.[0]&&2===i)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data")}async _fetchHeaderData(e,t,i){let r=this._getCachedHeaderData(e,t);if(r)return r;let a=Math.floor(e/this._bufferSize)*this._bufferSize,n=a+Math.max(1,Math.ceil((t-a)/this._bufferSize))*this._bufferSize,s=this._getMissingHeaderRanges(a,n).map(async e=>{let{from:t,to:r}=e,a=await this._fetchOffsets(t,r,i),n=this._fileSize;return{chunk:a,fileOffset:t,isEOF:n>0?t+a.byteLength>=n:a.byteLength<r-t+1}}),o=await Promise.all(s);this._headerChunks.push(...o),this._headerChunks.sort((e,t)=>e.fileOffset-t.fileOffset);let u=this._getCachedHeaderData(e,t);if(!u)throw new l.A("tiffraster:open",`failed to fetch byte range ${e}-${t} from ${this.url}`);return u}_getCachedHeaderData(e,t){let i=[],r=e;for(let{chunk:a,fileOffset:n,isEOF:s}of this._headerChunks){if(n+a.byteLength-1<r)continue;if(n>r)return null;let l=r-n,o=Math.min(t-n+1,a.byteLength);if(i.push({chunk:a,start:l,end:o}),r=n+o,r>t||s&&o===a.byteLength){let t=new Uint8Array(r-e),a=0;for(let e of i){let i=new Uint8Array(e.chunk,e.start,e.end-e.start);t.set(i,a),a+=i.byteLength}return t.buffer}}return null}_getMissingHeaderRanges(e,t){let i=[],r=(e,t)=>{let r=Math.floor(e/this._bufferSize)*this._bufferSize,a=Math.ceil(t/this._bufferSize)*this._bufferSize;i.push({from:r,to:a})},a=e;for(let{chunk:e,fileOffset:n,isEOF:s}of this._headerChunks){let l=n+e.byteLength-1;if(!(l<a)&&(n>a&&r(a,Math.min(n-1,t)),a=Math.max(a,l+1),a>t||s))return i}return a<=t&&r(a,t),i}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;if(a+8>=i.byteLength||a<0){if(r=a+r,r<0)throw new l.A("tiffraster:open",`invalid IFD position ${r}. failed to open url ${this.url}`);i=await this._fetchHeaderData(r,r+this._bufferSize/2,t),a=0}return{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let n=await this._readIFD(t,i,ze.NB,r,a);if(!n?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;t.posIFD=n.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=ze.NB,r=4,a){let{fileChunk:n,posIFD:s,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Pe.JM)(n,t,s,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==ze.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",Le);let r=[];e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),(0,Pe.fM)(e),(0,Pe.h_)(e);for(let[i,r]of ze.RR){let l=e.get(i),u=null!=l?.data&&Array.from(l.data.values()).some(e=>null==e.values&&null!=e.offlineOffsetSize);if(l&&(!l.data||u)){s=l.valueOffset-o;let e=await this._validateOrFetchHeaderBuffer({fileChunk:n,posIFD:s,fileOffset:o},a);l.data=(await this._readIFD(e,t,r,4,a))?.ifd}}return u}return u.requiredBufferSize?(n=await this._fetchHeaderData(o,o+s+u.requiredBufferSize+8,a),n.byteLength<s+u.requiredBufferSize?null:(e.fileChunk=n,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let n=a.map(e=>e.offlineOffsetSize),s=Math.min.apply(null,n.map(e=>e[0])),l=Math.max.apply(null,n.map(e=>e[0]+e[1])),o=1===n.length||l-s<=this._bufferSize;if(!o&&n.length>1&&(n.sort((e,t)=>e[0]-t[0]),o=n.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,n[0][0])===l),o){let e=Math.max(l,s+this._bufferSize/4),i=await this._fetchHeaderData(s,e,r);return void a.forEach(e=>(0,Pe.Cr)(i,t,e,s))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchHeaderData(i[0],i[1]+i[0],r);(0,Pe.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize;this._fileSize>0&&(t=Math.min(t,this._fileSize-1));let n=Math.ceil((t-e+1)/a),s=e;for(let e=0;e<n;e++)r.push(this.request(this.url,{range:{from:s,to:e===n-1?t:s+a-1},responseType:"array-buffer",signal:i})),s+=a;let l=await Promise.all(r);if(-1===this._fileSize&&206===l[0].httpStatus){let e=l[0].getHeader?.("Content-Range"),t=Number(e?.split("/",2)[1]);Number.isFinite(t)&&(this._fileSize=t)}if(1===l.length)return l[0].data;let o=l.reduce((e,t)=>e+t.data.byteLength,0),u=new Uint8Array(o),f=0;for(let e of l)u.set(new Uint8Array(e.data),f),f+=e.data.byteLength;return u.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let n=this._getTileLocation(e,t,i,r);if(!n)return null;let{ranges:s,actualTileWidth:l,actualTileHeight:o,ifd:u}=n,f=s.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),d=1===h.length?h[0].data:new ArrayBuffer(c),p=[0],m=[d.byteLength];if(h.length>1){let e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),p[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this.headerInfo,ifd:u,offsets:p,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:n}=this.rasterInfo.storageInfo,s=0===e?0:e-(a-1),{headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[s]:0===s?l.ifds[0]:l.pyramidIFDs[s-1];if(!o)return null;let u=(0,Pe.XO)(o),f=(0,Pe.wc)(o,"TILEOFFSETS"),h=(0,Pe.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:d,maxRow:p,maxCol:m}=n[s];if(t>p||i>m||t<c||i<d)return null;let g=(0,Pe.LZ)(o,"IMAGEWIDTH"),y=(0,Pe.LZ)(o,"IMAGELENGTH"),w=(0,Pe.LZ)(o,"TILEWIDTH"),v=(0,Pe.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(p+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===p&&y%v||v}}async _fetchAllAuxData(e){if(this.ioConfig.skipMapInfo)return;let{rasterInfo:t}=this,{skipExtensions:i=[]}=this.ioConfig,r=i.includes("aux.xml")?Promise.resolve(null):this._fetchAuxiliaryMetaData(e),a=i.includes("vat.dbf")||1!==t.bandCount||"u8"!==t.pixelType?Promise.resolve(null):this._fetchAuxiliaryTable(e),[n,s]=await Promise.all([r,a]);null!=n&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,Y.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new xe.A({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}(n,t),null!=s&&(t.attributeTable=s,t.keyProperties.DataType="thematic")}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,d.MZ)()],Ee.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,d.MZ)()],Ee.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,d.MZ)()],Ee.prototype,"_fileSize",void 0),(0,a.Cg)([(0,d.MZ)()],Ee.prototype,"_headerChunks",void 0),(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],Ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,d.MZ)()],Ee.prototype,"headerInfo",void 0),Ee=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.TIFFRaster")],Ee);const Be=Ee;var $e=i(91806);const Je=new Set(["x","lon","long","longitude","e","east","easting"]),Ue=new Set(["y","lat","latitude","n","north","northing"]),He=new Map([["b1","u8"],["u1","u8"],["u2","u16"],["u4","u32"],["i1","s8"],["i2","s16"],["i4","s32"],["f2","f32"],["f4","f32"],["f8","f64"],["c8","c64"],["c16","c128"],["m","unknown"],["M","unknown"],["S","unknown"],["U","unknown"],["V","unknown"]]),je="zarr-raster:parse";function Ze(e,t){return e.slice(0,-t.length)}function Ve(e,t){!function(e){if(2!==e?.zarr_format)throw new l.A(je,"only zarr_format 2 is supported");let{shape:t,compressor:i,order:r,chunks:a,dimension_separator:n}=e;if(!Array.isArray(t)||!Array.isArray(a)||t.length!==a.length||t.some(e=>!Number.isSafeInteger(e)||e<0)||a.some(e=>!Number.isSafeInteger(e)||e<=0))throw new l.A(je,"invalid Zarr shape or chunks");if(null!=r&&"C"!==r&&"F"!==r)throw new l.A(je,"invalid Zarr array order");if(null!=n&&"."!==n&&"/"!==n)throw new l.A(je,"invalid Zarr dimension separator");if(null!==i&&("string"!=typeof i?.id||!i.id))throw new l.A(je,"Zarr compressor must be null or have a codec id")}(e);let{isBigEndian:i,pixelType:r,originalPixelType:a}=function(e){if("string"!=typeof e)throw new l.A(je,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);let t=e.startsWith(">"),i=e.replace(/^[<>|=]/,""),r=He.get(i);if(!r||"unknown"===r||r.startsWith("c"))throw new l.A(je,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);return{isBigEndian:t,pixelType:r,originalPixelType:i}}(e.dtype),{shape:n,compressor:s,order:o,chunks:u}=e,f=s?.id||"none",h="C"===o||null==o,c=function(e){if(null!==e){if("number"==typeof e)return e;switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new l.A(je,`Unsupported numeric Zarr fill value: ${e}`)}}}(e.fill_value);if(null!=c)if(Number.isFinite(c)){"f32"===r&&(c="f2"===a?new Float16Array([c])[0]:Math.fround(c));let[e,t]=(0,$.hP)("f2"===a?"f16":r);(c>t||c<e)&&(c=void 0)}else c=r.startsWith("f")?c:void 0;let d=e.dimension_separator??".";return{isBigEndian:i,pixelType:r,originalPixelType:a,compression:f,isRowMajor:h,shape:n,chunkSize:u,fillValue:c,scaleFactor:t?.scale_factor??1,addOffset:t?.add_offset??0,separator:d}}function qe(e){return e.Description??e.description??e.long_name??e.standard_name??null}function We(e,t,i){let r=i?.[e];return!r?.length||t<=0?null:r.length<=t?r.toSorted((e,t)=>e-t):r.slice(0,t).toSorted((e,t)=>e-t)}function Ge(e){if(1===e.length)return[e[0]-.5,e[0]+.5];let t=e[0],i=e.at(-1),r=Math.abs(i-t)/(e.length-1)*.5;return[Math.min(t,i)-r,Math.max(t,i)+r]}function Xe(e){let t;for(let i=0;i<e.length;i++){let r=e[i],a=Ye(r);if(a)return new E.A({wkid:a});t||=r?._CRS?.wkt?.trim()}return t?new E.A({wkt:t}):void 0}function Ye(e){let t=e?._CRS?.projjson?.id?.code,i="CRS84"===t?4326:"CRS83"===t?4269:"CRS27"===t?4267:Number(t);if(Number.isSafeInteger(i)&&i>0)return i;let r=e?._CRS?.url;return"string"==typeof r&&Number(r.slice(r.lastIndexOf("/")+1))||void 0}function Ke(e){let t=e.attributes._ARRAY_DIMENSIONS,i=e.array.shape??[];return!t?.length||t.length!==i.length}function Qe(e,t){let i="x"===t?Je:Ue;return(e.find(e=>i.has(e.attributes.standard_name?.toLowerCase()??""))??e.find(e=>i.has(e.name.toLowerCase()??"")))?.name}function et(e,t){return`${e}/${t=t.split("/").map(encodeURIComponent).join("/")}`}const tt="zarr-raster:open",it=new Set(["none"]);let rt=class extends P.A{constructor(){super(...arguments),this.datasetFormat="ZARR"}get _baseUrl(){let{url:e}=this;return e.endsWith("/.zmetadata")||e.endsWith("/.zgroup")?e.slice(0,e.lastIndexOf("/")):e}async fetchRawTile(e,t,i,r={}){let{multidimensionalDefinition:a}=r;if(!a?.length)return null;let n=a[0].variableName,s=this._metadata.dataVariables.find(e=>e.name===n);if(!s)return null;let{storageInfo:o}=s,u=Object.fromEntries(a.map(e=>[e.dimensionName,e.values[0]])),f=this._getDimensionIndices(s,t,i,u);if(!f)return null;let h=s.attributes._ARRAY_DIMENSIONS,{xDimension:c,yDimension:d}=this._metadata,p=function(e,t,i,r){let{chunkSize:a,shape:n,pixelType:s,separator:l,isRowMajor:o,fillValue:u,scaleFactor:f,addOffset:h}=e,c=Array(n.length),d=Array(n.length),p=Array(n.length),m=1;for(let e=0;e<n.length;e++){let i=t[e];if(i<0||i>=n[e])return null;let r=a[e],s=Math.floor(i/r);c[e]=s,d[e]=i-s*r,p[e]=Math.min(r,n[e]-s*r),m*=r}return{chunkPath:c.join(l),chunkSize:a,actualSize:p,offsets:d,xIndex:i,yIndex:r,pixelType:s,isRowMajor:o,elementCount:m,fillValue:u,scaleFactor:f,addOffset:h}}(o,f,h.indexOf(c),h.indexOf(d));if(!p)return null;let m=et(this._baseUrl,`${n}/${p.chunkPath}`),{data:g}=await this.request(m,{responseType:"array-buffer",signal:r.signal}),{actualSize:y,elementCount:w}=p,v=this._decodeChunk(g,o),x=y.reduce((e,t)=>e*t,1),b=v.length;if(b!==w&&b!==x)throw new l.A("zarr-raster:decode",`Invalid chunk length ${b} for "${m}"; expected ${w} or ${x} values`);return function(e,t){let i,{chunkSize:r,actualSize:a,xIndex:n,yIndex:s}=t,l=r[n],o=r[s],u=a[n],f=a[s],h=function(e,t){let{chunkSize:i,actualSize:r,xIndex:a,yIndex:n,pixelType:s,elementCount:l,isRowMajor:o}=t,u=i[a],f=i[n],h=e.length===l?i:r;return e.length===u*f&&h[a]===u&&h[n]===f?(o?n<a:a<n)?e:function(e,t,i,r){let a=new(J.A.getPixelArrayConstructor(r))(e.length);for(let r=0;r<i;r++)for(let n=0;n<t;n++)a[r*t+n]=e[n*i+r];return a}(e,u,f,s):function(e,t,i){let{chunkSize:r,actualSize:a,offsets:n,xIndex:s,yIndex:l,pixelType:o,isRowMajor:u}=t,f=r[s],h=r[l],c=a[s],d=a[l],p=Array(i.length),m=1;for(let e=0;e<i.length;e++){let t=u?i.length-1-e:e;p[t]=m,m*=i[t]}let g=new(J.A.getPixelArrayConstructor(o))(f*h);for(let t=0;t<d;t++)for(let r=0;r<c;r++){let a=0;for(let e=0;e<i.length;e++){let i=n[e];e===s?i=r:e===l&&(i=t),a+=i*p[e]}g[t*f+r]=e[a]}return g}(e,t,h)}(e,t);if(u<l||f<o){i=new Uint8Array(l*o);for(let e=0;e<f;e++)i.fill(1,e*l,e*l+u)}let{fillValue:c}=t;if(null!=c){let e=Number.isNaN(c);for(let t=0;t<f;t++)for(let r=0;r<u;r++){let a=t*l+r,n=h[a];(n===c||e&&Number.isNaN(n))&&(i??=new Uint8Array(l*o).fill(1),i[a]=0)}}let{pixelType:d,scaleFactor:p,addOffset:m}=t,g=d,y=h;if(1!==p||0!==m){g="f64"===d?"f64":"f32",y=new(J.A.getPixelArrayConstructor(g))(h.length);for(let e=0;e<h.length;e++)y[e]=0===i?.[e]?h[e]:h[e]*p+m}return new J.A({width:l,height:o,pixelType:g,pixels:[y],mask:i})}(v,p)}async _open(e){let t=this.url.slice(this.url.lastIndexOf("/")+1);if(t.endsWith(".zattrs")||t.endsWith(".zarray"))throw new l.A(tt,`Unsupported Zarr URL: "${this.url}". Expect a v2 root url or consolidated metadata url`);let i=this._baseUrl;this.datasetName=i.slice(i.lastIndexOf("/")+1).replace(".zarr","");let r=e?.signal??void 0,{data:a}=await this.request(`${i}/.zmetadata`,{signal:r}),n=function(e){let t=e?.metadata;if("object"!=typeof t||!t||Array.isArray(t))throw new l.A(je,"missing consolidated metadata root");let i=new Map;for(let[e,r]of Object.entries(t))if(e.endsWith("/.zarray")){let a=r,n=Ze(e,"/.zarray"),s=t[`${n}/.zattrs`],o=Ve(a,s);if(s){let e=s._ARRAY_DIMENSIONS;if(!e?.length)throw new l.A(je,`missing required _ARRAY_DIMENSIONS attribute for array "${n}"`);if(null!=s.scale_factor&&!Number.isFinite(s.scale_factor)||null!=s.add_offset&&!Number.isFinite(s.add_offset))throw new l.A(je,`Invalid scale_factor or add_offset for array "${n}"`);let t=1===e.length&&e[0]===n,r=Xe([s]),{shape:u,chunkSize:f}=o;if(e.length!==u.length||e.length!==f.length)throw new l.A(je,`variable dimensions do not match shape for array "${n}"`);i.set(n,{name:n,isDimension:t,storageInfo:o,spatialReference:r,array:a,attributes:s})}}if(0===i.size)throw new l.A(je,"no arrays found");let r=Array.from(i.values()),{xDimension:a,yDimension:n}=function(e){let t=e.filter(e=>e.isDimension),i=t.map(e=>e.name),r=Qe(t,"x"),a=Qe(t,"y");if(!r||!a){let t=(e.find(e=>!e.isDimension&&(e.attributes._ARRAY_DIMENSIONS?.length??0)>=2)?.attributes._ARRAY_DIMENSIONS)?.filter(e=>i.includes(e))??i;r??=t.findLast(e=>e!==a),a??=t.findLast(e=>e!==r)}if(!r||!a||r===a)throw new l.A(je,`Unable to determine x and y dimensions from variable dimensions "${i.join(", ")}"`);return{xDimension:r,yDimension:a}}(r),s=function(e,t,i){let r=e.filter(e=>{let r=!e.isDimension,a=e.attributes._ARRAY_DIMENSIONS,n=a?.includes(t)&&a.includes(i);return r&&n});if(0===r.length)throw new l.A(je,"no valid data variables found");if(r.some(Ke))throw new l.A(je,"some variable dimensions do not match shape");let a=e.filter(e=>e.isDimension),n=r[0],s=n.attributes._ARRAY_DIMENSIONS,o=n.storageInfo.chunkSize[s.indexOf(t)],u=n.storageInfo.chunkSize[s.indexOf(i)];for(let e of r){let r=e.attributes._ARRAY_DIMENSIONS;if(r.some((t,i)=>{let r=a.find(e=>e.name===t);return r&&r.storageInfo.shape[0]!==e.storageInfo.shape[i]}))throw new l.A(je,`Coordinate dimensions do not match shape for "${e.name}"`);let{chunkSize:s}=e.storageInfo;if(s[r.indexOf(t)]!==o||s[r.indexOf(i)]!==u)throw new l.A(je,`X/Y chunk sizes must match across variables: compare ${e.name} ${n.name}`)}return r}(r,a,n),o=r.filter(e=>e.isDimension);return{dataDimensions:o,dataVariables:s,spatialReference:s.find(e=>e.spatialReference)?.spatialReference??o.find(e=>e.spatialReference)?.spatialReference,xDimension:a,yDimension:n,version:2}}(a);this._metadata=n;let s=[...n.dataDimensions,...n.dataVariables].find(({storageInfo:{compression:e}})=>!it.has(e));if(s)throw new l.A(tt,`Unsupported Zarr compression "${s.storageInfo.compression}" for array "${s.name}"`);let o={};await Promise.all(n.dataDimensions.map(e=>this._readDimensionValues(e,o,r)));let u=function(e,t){let{dataDimensions:i,dataVariables:r,spatialReference:a}=e,n=r[0],s=n.attributes._ARRAY_DIMENSIONS??[],{xDimension:o,yDimension:u}=e,f=i.find(e=>e.name===o)?.storageInfo.shape[0],h=i.find(e=>e.name===u)?.storageInfo.shape[0];if(!f||!h)throw new l.A(je,`Unable to determine width and height from dimensions "${o}" and "${u}"`);let c=t[o],d=t[u];if(c.some((e,t)=>t>0&&e<c[t-1])||d.some((e,t)=>t>0&&e>d[t-1]))throw new l.A(je,"Unsupported spatial coordinates order, must be ascending X and descending Y");let[p,m]=Ge(c),[g,y]=Ge(d),w=new L.A({xmin:p,ymin:g,xmax:m,ymax:y,spatialReference:a}),v=Math.abs((m-p)/f),x=Math.abs((y-g)/h),b={x:v,y:x},I=new Map;for(let e of i){let i=e.name;if(i===o||i===u)continue;let r=e.storageInfo.shape[0],a=We(i,r,t),{attributes:n}=e;I.set(i,{name:i,description:qe(n),unit:n.units,values:a,extent:a?[a[0],a.at(-1)]:r>0?[0,r-1]:void 0})}let A=[];for(let e of r){let t=e.attributes._ARRAY_DIMENSIONS.map(e=>I.get(e)).filter(e=>!!e),{attributes:i}=e;A.push({name:e.name,description:qe(i),unit:i.units??null,dimensions:t})}let S=A.length?{variables:A}:null,{pixelType:C}=n.storageInfo;for(let{storageInfo:e}of r){if("f64"===e.pixelType){C="f64";break}("f32"===e.pixelType||1!==e.scaleFactor||0!==e.addOffset)&&(C="f32")}let _={DataType:S?"Scientific":"Generic"},{chunkSize:R}=n.storageInfo,M=R[s.indexOf(o)],T=R[s.indexOf(u)],O=[{minCol:0,maxCol:Math.ceil(f/M)-1,minRow:0,maxRow:Math.ceil(h/T)-1}],k=new xe.A({x:p,y,spatialReference:a}),F=(v+x)/2,N=new Ie.A({origin:k,size:[M,T],spatialReference:a,lods:[new $e.A({level:0,resolution:F,scale:1/.0254*96*F})]}),P=new be.A({blockWidth:M,blockHeight:T,pyramidBlockWidth:M,pyramidBlockHeight:T,compression:n.storageInfo.compression,origin:k,firstPyramidLevel:0,maximumPyramidLevel:0,blockBoundary:O,tileInfo:N,isVirtualTileInfo:!1}),z=n.storageInfo.fillValue,E=new Q.A({width:f,height:h,pixelSize:b,pixelType:C,bandCount:1,noDataValue:z,extent:w,spatialReference:a,keyProperties:_,multidimensionalInfo:S,isPseudoSpatialReference:!1,format:"zarr",storageInfo:P});return(0,D.vj)(E),E}(n,o);this._dimensionValues=o,this._set("rasterInfo",u)}_getDimensionIndices(e,t,i,r){let a=e.attributes._ARRAY_DIMENSIONS,{xDimension:n,yDimension:s}=this._metadata,{chunkSize:l}=e.storageInfo;if(!this.rasterInfo.multidimensionalInfo?.variables.find(t=>t.name===e.name)?.dimensions?.length)return null;let o=[];for(let e=0;e<a.length;e++){let u=a[e];if(u===n)o[e]=i*l[e];else if(u===s)o[e]=t*l[e];else{let t=this._dimensionValues[u],i=r[u],a=t?.indexOf(i)??-1;if(a<0)return null;o[e]=a}}return o}async _readDimensionValues(e,t,i){let{name:r,storageInfo:a}=e,n=a.chunkSize[0],s=a.shape[0];if(n<=0||s<=0)throw new l.A(tt,`Invalid dimension array "${r}" with chunkSize ${n} and totalElements ${s}`);let o=Math.ceil(s/n),u=this._baseUrl,f=[];for(let e=0;e<o;e++){let t=et(u,`${r}/${e}`),c=e===o-1?s-e*n:n;f.push(this.request(t,{responseType:"array-buffer",signal:i}).then(e=>{let t=this._decodeChunk(e.data,a);if(t.length!==n&&t.length!==c)throw new l.A(tt,`Invalid dimension chunk length for "${r}"`);return t.slice(0,c)}).catch(e=>{throw(0,h.zf)(e)?e:new l.A(tt,`Unable to fetch dimension data for "${r}"`)}))}let c=(await Promise.all(f)).flatMap(e=>Array.from(e)),{scaleFactor:d,addOffset:p}=a;if(1!==d||0!==p)for(let e=0;e<c.length;e++)c[e]=c[e]*d+p;t[r]="days since 1899-12-30 00:00:00 UTC"===e.attributes.units?c.map(G.$E):c}_decodeChunk(e,t){let{compression:i}=t;if(!it.has(i))throw new l.A("zarr-raster:decode",`Unsupported Zarr compression "${i}"`);return function(e,t){let{pixelType:i,originalPixelType:r}=t,a=!t.isBigEndian,n=J.A.getPixelArrayConstructor(i);if(a&&"f2"!==r)return new n(e);let s="f2"===r?2:(0,$.Qd)(i),o=e.byteLength/s,u=new DataView(e),f=new n(o);for(let e=0,t=0;e<o;t+=s,e++)switch(i){case"s8":f[e]=u.getInt8(t);break;case"u8":f[e]=u.getUint8(t);break;case"s16":f[e]=u.getInt16(t,a);break;case"u16":f[e]=u.getUint16(t,a);break;case"s32":f[e]=u.getInt32(t,a);break;case"u32":f[e]=u.getUint32(t,a);break;case"f32":f[e]="f2"===r?u.getFloat16(t,a):u.getFloat32(t,a);break;case"f64":f[e]=u.getFloat64(t,a);break;default:throw new l.A("zarr-raster:decode",`Unsupported coordinate pixel type: ${i}`)}return f}(e,t)}};(0,a.Cg)([(0,d.MZ)()],rt.prototype,"_baseUrl",null),(0,a.Cg)([(0,d.MZ)({json:{write:!0}})],rt.prototype,"_dimensionValues",void 0),(0,a.Cg)([(0,d.MZ)({json:{write:!0}})],rt.prototype,"_metadata",void 0),(0,a.Cg)([(0,d.MZ)({type:String,json:{write:!0}})],rt.prototype,"datasetFormat",void 0),rt=(0,a.Cg)([(0,d.$K)("esri.layers.raster.datasets.ZarrRaster")],rt);const at=rt,nt=new Map;nt.set("RasterTileServer",{desc:"Raster Tile Server",constructor:_e}),nt.set("TIFF",{desc:"Cloud Optimized GeoTIFF",constructor:Be}),nt.set("MRF",{desc:"Meta Raster Format",constructor:ke}),nt.set("ZARR",{desc:"Zarr Raster Format",constructor:at}),nt.set("JPG",{desc:"JPG Raster Format",constructor:we}),nt.set("PNG",{desc:"PNG Raster Format",constructor:we}),nt.set("GIF",{desc:"GIF Raster Format",constructor:we}),nt.set("BMP",{desc:"BMP Raster Format",constructor:we}),nt.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),nt.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class st{static get supportedFormats(){let e=new Set;return nt.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,n=e.datasetFormat??i?.datasetFormat;n??(/(?:\.zarr|\/\.(?:zmetadata|zarray|zgroup))$/.test(t)?n="ZARR":t.includes(".")?n=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?n="CovJSON":r?.extent&&r.pixelblocks&&(n="MEMORY")),"OVR"===n||"TIF"===n||"DM"===n?n="TIFF":"JPG"===n||"JPEG"===n||"JFIF"===n?n="JPG":"COVJSON"===n&&(n="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");let s={url:t,source:r,sourceJSON:a,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(s).forEach(e=>{s[e]??delete s[e]}),n){if(!this.supportedFormats.has(n))throw new l.A("rasterfactory:open","not a supported format "+n);if("CRF"===n)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(nt.get(n).constructor)(s);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(nt.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(n=o[u++],!n||"CRF"===n)return null;let t=new(nt.get(n).constructor)(s);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){nt.has(e.toUpperCase())||nt.set(e.toUpperCase(),{desc:t,constructor:i})}}var lt=i(99235),ot=i(10873),ut=i(20437),ft=i(74797),ht=i(22796),ct=i(69409);const dt={instance:null,refCount:0,connectionPromise:null};async function pt(){if(dt.refCount++,dt.instance)return dt.instance;if(!dt.connectionPromise){let e=new ct.A;dt.connectionPromise=e.initialize().then(()=>{dt.instance=e})}return await dt.connectionPromise,dt.instance}function mt(){dt.refCount--,dt.refCount>0||(dt.instance?.destroy(),dt.instance=null,dt.connectionPromise=null,dt.refCount=0)}var gt=i(24212),yt=i(30291),wt=i(88625),vt=i(59923);let xt=class extends((0,A.dM)((0,O.j)((0,C.q)((0,_.A)((0,M.H)((0,S.d)((0,F.b)((0,R.G)((0,k.e)((0,I.b)((0,T.J)((0,f.M)((0,s.OU)(b.A)))))))))))))){constructor(e){super(e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:n}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return n(this,r,t)}})}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,ft.rZ)("Pixel Value"),(0,ft.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,ft.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,ft.DV)(t),r=(0,ft.y6)();e.push(i,r)}if(a){let t=(0,ft.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==ft.F_.rawServicePixelValue)),r=(0,yt.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,ft.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,p.PZ)(ht.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,vt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,D.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,D.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,lt.UD)(t.toJSON(),a),a.some(e=>It(e,this.ioConfig))&&(r=await pt(),this._releaseWorkerHandle={remove:()=>mt()});let n=await Promise.all(a.map(e=>st.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),s=n.findIndex(e=>null==e);if(s>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[s]}`);return this._primaryRasters=n,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;It(e,this.ioConfig)&&(i=await pt(),this._releaseWorkerHandle={remove:()=>mt()});let r=await st.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await st.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,lt.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new N.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,gt.XF)(o.A.getLogger(this),(0,gt.$7)("ImageryTile layers","relative-to-scene",e)),(0,gt.XF)(o.A.getLogger(this),(0,gt.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,d.MZ)({clonable:!1})],xt.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,d.MZ)({clonable:!1})],xt.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,d.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],xt.prototype,"charts",void 0),(0,a.Cg)([(0,d.MZ)({type:wt.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],xt.prototype,"elevationInfo",null),(0,a.Cg)([(0,d.MZ)({type:Ie.A})],xt.prototype,"tileInfo",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0,clonable:!1})],xt.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,d.MZ)(ot.fV)],xt.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,d.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],xt.prototype,"isReference",void 0),(0,a.Cg)([(0,d.MZ)({type:["show","hide"]})],xt.prototype,"listMode",void 0),(0,a.Cg)([(0,d.MZ)({json:{read:!0,write:!0}})],xt.prototype,"blendMode",void 0),(0,a.Cg)([(0,d.MZ)({type:ht.A,json:{name:"renderingRule",write:!0}})],xt.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,d.MZ)()],xt.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],xt.prototype,"version",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0,json:{read:!1}})],xt.prototype,"type",void 0),(0,a.Cg)([(0,d.MZ)({type:["ArcGISTiledImageServiceLayer"]})],xt.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,d.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}}}})],xt.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,d.MZ)({type:n.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],xt.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0})],xt.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,d.MZ)(ot.PY)],xt.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0,type:[ut.A]})],xt.prototype,"fields",void 0),(0,a.Cg)([(0,d.MZ)({readOnly:!0,type:[ut.A]})],xt.prototype,"rasterFields",null),(0,a.Cg)([(0,d.MZ)({constructOnly:!0})],xt.prototype,"source",void 0),xt=(0,a.Cg)([(0,d.$K)("esri.layers.ImageryTileLayer")],xt);const bt=xt;function It(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),n=i(91429),s=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,s.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,s.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,n.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,n.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,n.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>c});var r=i(32198),a=i(91429),n=i(69540),s=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,n.OU)(s.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=f,c=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[h],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},43163(e,t,i){i.d(t,{A:()=>p});var r,a=i(32198),n=i(91429),s=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,n=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+n*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+n*e[9]+i*e[11]}}let n=r*r,s=a*a,l=r*a,o=n*r,u=n*a,f=r*s,h=a*s;return{x:e[0]+r*e[2]+a*e[4]+n*e[6]+l*e[8]+s*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+n*e[7]+l*e[9]+s*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function d(e,t,i){let{xmin:r,ymin:a,xmax:n,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:n,y:l}),u.push({x:r,y:a}),u.push({x:n,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:n,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(n-r)*t/e,y:a}),u.push({x:r+(n-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new s.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let p=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,n,s]=e,l=r*s-n*a,o=n*a-r*s;return[(n*i-t*s)/l,(r*i-t*a)/o,s/l,a/o,-n/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],p.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],p.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],p.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],p.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,n.MZ)()],p.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],p.prototype,"type",void 0),p=r=(0,a.Cg)([(0,n.$K)("esri.layers.raster.transforms.PolynomialTransform")],p)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),n=i(56507),s=i(56372),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),d=i(76030),p=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,n=!0,s=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(s=!1,o[u]|=1<<t):n=!1,31===t&&++u}s?(this._availability="unavailable",this.byteSize=40):n?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,n=this._availability;return a<0||a>n.length?"unknown":n[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||n.A,{row:r,col:a,width:s,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:s,height:o},valid:!0,data:Array(s*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==s||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:s,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends s.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=n.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let n=this.layer.tileInfo;n.updateTileInfo(r);let s=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(n.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,s),s}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,n){if(!this._prefetchingEnabled)return;let s=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(s))return;let l=new AbortController;n.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,s),await(0,d.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(s)),(0,h.G4)(l))return;let c=new g.U(e,t,i),p={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,p);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,n=this._tilemapFromCache(e,t,i,a);if(n)return Promise.resolve(n);let s=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(s,()=>t((0,h.NK)()));let i=x(a),n=this._pendingTilemapRequests[i];if(!n){n=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=n,n.then(e,e)}n.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,p.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>p,Tw:()=>c,X6:()=>d});var r=i(56507),a=i(5443),n=i(86738),s=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:d}=t||{},p=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:p,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=d||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,A=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,C=await Promise.allSettled([v,x,b,I,A,S]),_=a.A.fromJSON(y.extent),R=Math.ceil(_.width/y.pixelSizeX-.1),M=Math.ceil(_.height/y.pixelSizeY-.1),T=s.A.fromJSON(y.spatialReference||y.extent.spatialReference),O="fulfilled"===C[0].status?C[0].value?.data:null,k=O?.features?.length?f.A.fromJSON(O):null,F="fulfilled"===C[1].status?C[1].value?.data.colormap:null,D=F?.length?F:null,N="fulfilled"===C[2].status?C[2].value?.data.histograms:null,P=N?.[0]?.counts?.length?N:null,z="fulfilled"===C[3].status?C[3].value?.data??{}:{},L="fulfilled"===C[4].status?C[4].value?.data.multidimensionalInfo:null,E=L?.variables?.length?L:null;var B;(B=E)&&B.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let $=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===C[5].status?C[5].value?.data.statistics:null),{defaultVariable:J,serviceDataType:U}=y;J&&J!==z.DefaultVariable&&(z.DefaultVariable=J),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(z.DataType)&&(z.DataType=U.replace("esriImageServiceDataType",""));let H=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==H)&&(H=y.noDataValues);let j=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new n.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:T}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,M))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:R,height:M,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:T,pixelSize:new n.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:T}),pixelType:y.pixelType.toLowerCase(),statistics:$,attributeTable:k,colormap:D,histograms:P,keyProperties:z,noDataValue:H,multidimensionalInfo:E,storageInfo:j})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function d(e,t,i){return h(e,{rasterFunction:t},i)}function p(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),n=i(4718),s=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,s.An)(e):(0,n.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let n=e[a];if(null!=n&&"function"!=typeof n)if(Array.isArray(n))r[a]=n.map(e=>f(e));else if("object"==typeof n)if(n.toJSON){let e=n.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?n:JSON.stringify(n);else r[a]=n}return r}async function h(e,t,n){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(4189)]).then(()=>i(98232)),(await a.id.getCredential(e,n))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>s});var r=i(56512),a=i(86211),n=i(16271);function s(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:d}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,n.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",n=(0,a.mq)(i);return n?(0,a.oU)(e,r,n):0});const c={mode:"absolute-height",offset:0},d={mode:"on-the-ground",offset:null}}}]);
|