@arcgis/core 4.33.0-next.20250417 → 4.33.0-next.20250418

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{afcb12bf54a5656f641e.js → 02176f84d6d57f1bc1c8.js} +2 -2
  3. package/assets/esri/core/workers/chunks/{afcb12bf54a5656f641e.js.LICENSE.txt → 02176f84d6d57f1bc1c8.js.LICENSE.txt} +1 -1
  4. package/assets/esri/core/workers/chunks/{2db5dd5638c93b0af102.js → 0a7cba60a5286ba621d4.js} +1 -1
  5. package/assets/esri/core/workers/chunks/0c6f2808c57ff820bfdd.js.LICENSE.txt +1 -1
  6. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +1 -0
  7. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +1 -0
  8. package/assets/esri/core/workers/chunks/38f9ede26098eb03ca2d.js.LICENSE.txt +1 -1
  9. package/assets/esri/core/workers/chunks/{c616139a160eab9cd717.js → 4867a515ddbdab97cc61.js} +1 -1
  10. package/assets/esri/core/workers/chunks/5db336767959507c07e5.js.LICENSE.txt +1 -1
  11. package/assets/esri/core/workers/chunks/814d72abbfdd4552e4ec.js.LICENSE.txt +1 -1
  12. package/assets/esri/core/workers/chunks/93f792f5b94f3745b57d.js.LICENSE.txt +1 -1
  13. package/assets/esri/core/workers/chunks/ae13bd77a25ce8b54631.js +1 -0
  14. package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
  15. package/assets/esri/core/workers/chunks/d28e2c9bdf514236b011.js +1 -0
  16. package/assets/esri/core/workers/chunks/dbaa4b8d37aab40d7bd1.js.LICENSE.txt +1 -1
  17. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  18. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  19. package/chunks/BloomComposition.glsl.js +25 -19
  20. package/chunks/ChapmanAtmosphere.glsl.js +1 -1
  21. package/chunks/Fog.glsl.js +3 -3
  22. package/chunks/Haze.glsl.js +1 -1
  23. package/interfaces.d.ts +89 -0
  24. package/layers/VideoLayer.js +1 -1
  25. package/layers/support/domainUtils.js +1 -1
  26. package/layers/support/fieldUtils.js +1 -1
  27. package/layers/support/labelingInfo.js +1 -1
  28. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  29. package/layers/video/VideoController.js +1 -1
  30. package/layers/video/videoUtils.js +1 -1
  31. package/networks/UtilityNetwork.js +1 -1
  32. package/package.json +2 -2
  33. package/rest/featureService/FeatureService.js +1 -1
  34. package/rest/networks/support/NetworkElement.js +1 -1
  35. package/rest/networks/support/TelecomNetworkElement.js +5 -0
  36. package/support/revision.js +1 -1
  37. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  38. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  39. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  40. package/views/2d/layers/VideoLayerView2D.js +1 -1
  41. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  42. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
  43. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
  44. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  45. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
  46. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  47. package/views/3d/webgl-engine/effects/haze/HazeTechniqueConfiguration.js +1 -1
  48. package/views/3d/webgl-engine/shaders/ToneMapping.glsl.js +20 -2
  49. package/widgets/Editor.js +1 -1
  50. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  51. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  52. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  53. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  54. package/widgets/OrientedImageryViewer.js +1 -1
  55. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  56. package/widgets/Slider/SliderViewModel.js +1 -1
  57. package/widgets/Slider.js +1 -1
  58. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  59. package/assets/esri/core/workers/chunks/3b8eee013d7ca156ef2d.js +0 -1
  60. package/assets/esri/core/workers/chunks/3ee505f9ddb671dcfa52.js +0 -1
  61. package/assets/esri/core/workers/chunks/7f36cffc6ed984b7e467.js +0 -1
  62. package/assets/esri/core/workers/chunks/efb0f3ec2344adcb24f3.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../geometry/Point.js";import t from"../../geometry/Polygon.js";import r from"../../geometry/Polyline.js";import n from"../support/TelemetryData.js";import i from"../support/VideoTimeExtent.js";const o="application/x-mpegURL",a="video/mp4",u="video/webm",s={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,EsriFrameCenterLatitude:90050,EsriFrameCenterLongitude:90051,EsriCornerLatitudePt1:90052,EsriCornerLongitudePt1:90053,EsriCornerLatitudePt2:90054,EsriCornerLongitudePt2:90055,EsriCornerLatitudePt3:90056,EsriCornerLongitudePt3:90057,EsriCornerLatitudePt4:90058,EsriCornerLongitudePt4:90059,EsriFrameOutline:90060,EsriSensorPosition:90061,EsriHorizonPixelPack:90063,EsriGroundControlPoints:90064};function l(e){const{duration:t,end:r,start:n,timezone:o="UTC"}=e||{};return"number"!=typeof t?null:new i({duration:t||null,end:"number"==typeof r?new Date(r):null,start:"number"==typeof n?new Date(n):null,timezone:o})}function d(e,t){const r=[...t],n=r.findIndex((t=>t.equals(e)));return n>-1&&r.splice(n),r.push(e),r}function g(e){if(!e?.size)return new n;const t=p(e),r=C(e),i=S(e),o=y(t,r);return new n({frameCenter:r,frameOutline:i,lineOfSight:o,sensorLocation:t})}function f(e){if(!e?.size)return null;return e.get(s.EsriGroundControlPoints)?.value??null??null}function L(e){return e?.size?e.get(s.EsriHorizonPixelPack)?.value??null:null}function C(e){return c(e)??E(e)}function m(e){if(!e)return o;const t=e.match(/\.(\w{3,4})(?:$|\?)/i);if(!t)return o;switch(t[1].toLowerCase()){case"mp4":return a;case"webm":return u;default:return o}}function P(e){const t=e?.layers;return t?.length?t.map((e=>({layerId:e.id,posterUrl:e.poster,sourceType:e.serviceType,title:e.name,type:e.type||"Video Layer"}))):[]}function c(t){return t&&t.has(s.EsriFrameCenterLatitude)&&t.has(s.EsriFrameCenterLongitude)?new e({x:t.get(s.EsriFrameCenterLongitude).value,y:t.get(s.EsriFrameCenterLatitude).value,z:t.get(s.FrameCenterElevation).value}):null}function E(t){return t&&t.has(s.FrameCenterLatitude)&&t.has(s.FrameCenterLongitude)?new e({x:t.get(s.FrameCenterLongitude)?.value,y:t.get(s.FrameCenterLatitude)?.value,z:t.get(s.FrameCenterElevation)?.value}):null}function S(e){if(!e)return null;const r=e.get(s.EsriFrameOutline)?.value;return r?t.fromJSON(r.geometry):h(e)??v(e)}function h(e){if(!(e.has(s.EsriCornerLatitudePt1)&&e.has(s.EsriCornerLongitudePt1)&&e.has(s.EsriCornerLatitudePt2)&&e.has(s.EsriCornerLongitudePt2)&&e.has(s.EsriCornerLatitudePt3)&&e.has(s.EsriCornerLongitudePt3)&&e.has(s.EsriCornerLatitudePt4)&&e.has(s.EsriCornerLongitudePt4)))return null;const r=[e.get(s.EsriCornerLongitudePt1)?.value,e.get(s.EsriCornerLatitudePt1)?.value],n=[e.get(s.EsriCornerLongitudePt2)?.value,e.get(s.EsriCornerLatitudePt2)?.value],i=[e.get(s.EsriCornerLongitudePt3)?.value,e.get(s.EsriCornerLatitudePt3)?.value],o=[e.get(s.EsriCornerLongitudePt4)?.value,e.get(s.EsriCornerLatitudePt4)?.value];return new t({rings:[[r,n,i,o]]})}function v(e){if(!(e.has(s.OffsetCorner1Latitude)&&e.has(s.OffsetCorner1Longitude)&&e.has(s.OffsetCorner2Latitude)&&e.has(s.OffsetCorner2Longitude)&&e.has(s.OffsetCorner3Latitude)&&e.has(s.OffsetCorner3Longitude)&&e.has(s.OffsetCorner4Latitude)&&e.has(s.OffsetCorner4Longitude)&&e.has(s.FrameCenterLatitude)&&e.has(s.FrameCenterLongitude)))return null;const r=e.get(s.FrameCenterLatitude)?.value,n=e.get(s.FrameCenterLongitude)?.value,i=r+e.get(s.OffsetCorner1Latitude)?.value,o=n+e.get(s.OffsetCorner1Longitude)?.value,a=r+e.get(s.OffsetCorner2Latitude)?.value,u=n+e.get(s.OffsetCorner2Longitude)?.value,l=r+e.get(s.OffsetCorner3Latitude)?.value,d=n+e.get(s.OffsetCorner3Longitude)?.value,g=r+e.get(s.OffsetCorner4Latitude)?.value,f=n+e.get(s.OffsetCorner4Longitude)?.value;return new t({rings:[[[o,i],[u,a],[d,l],[f,g]]]})}function y(e,t){if(!e||!t)return null;const n=[e.x,e.y,e.z??0],i=[t.x,t.y,t.z??0];return new r({paths:[[n,i]]})}function p(t){if(!t?.size)return null;if(t.has(s.EsriSensorPosition)){const r=t.get(s.EsriSensorPosition)?.value;if(r)return e.fromJSON(r.geometry)}return t.has(s.SensorLongitude)&&t.has(s.SensorLatitude)&&t.has(s.SensorTrueAltitude)?new e({x:t.get(s.SensorLongitude)?.value,y:t.get(s.SensorLatitude)?.value,z:t.get(s.SensorTrueAltitude)?.value}):null}export{C as getFrameCenter,L as getFrameHorizonPoints,f as getGroundControlPoints,d as getSensorTrailPoints,P as getServiceLayersInfo,g as getTelemetryData,m as getVideoMimeType,l as readVideoTimeExtent,s as videoMetadataEntryId};
5
+ import e from"../../geometry/Point.js";import t from"../../geometry/Polygon.js";import r from"../../geometry/Polyline.js";import n from"../support/TelemetryData.js";import i from"../support/VideoTimeExtent.js";const o="application/x-mpegURL",a="video/mp4",u="video/webm",s={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,EsriFrameCenterLatitude:90050,EsriFrameCenterLongitude:90051,EsriCornerLatitudePt1:90052,EsriCornerLongitudePt1:90053,EsriCornerLatitudePt2:90054,EsriCornerLongitudePt2:90055,EsriCornerLatitudePt3:90056,EsriCornerLongitudePt3:90057,EsriCornerLatitudePt4:90058,EsriCornerLongitudePt4:90059,EsriFrameOutline:90060,EsriSensorPosition:90061,EsriHorizonPixelPack:90063,EsriGroundControlPoints:90064};function l(e,t=1e4){if(!e||!e.length)return[];let r=[],n=[];for(let o=0;o<e.length;o++){const t=e[o],n=t?.text?JSON.parse(t.text):null;"EsriVideoServer"===n?.source&&(r=[...n.data])}const i=r.find((e=>e.tagId===t));return Array.isArray(i?.value)&&(n=[...i.value]),n}function d(e){const{duration:t,end:r,start:n,timezone:o="UTC"}=e||{};return"number"!=typeof t?null:new i({duration:t||null,end:"number"==typeof r?new Date(r):null,start:"number"==typeof n?new Date(n):null,timezone:o})}function g(e,t){const r=[...t],n=r.findIndex((t=>t.equals(e)));return n>-1&&r.splice(n),r.push(e),r}function f(e){if(!e?.size)return new n;const t=O(e),r=m(e),i=v(e),o=p(t,r);return new n({frameCenter:r,frameOutline:i,lineOfSight:o,sensorLocation:t})}function L(e){if(!e?.size)return null;return e.get(s.EsriGroundControlPoints)?.value??null??null}function C(e){return e?.size?e.get(s.EsriHorizonPixelPack)?.value??null:null}function m(e){return E(e)??S(e)}function c(e){if(!e)return o;const t=e.match(/\.(\w{3,4})(?:$|\?)/i);if(!t)return o;switch(t[1].toLowerCase()){case"mp4":return a;case"webm":return u;default:return o}}function P(e){const t=e?.layers;return t?.length?t.map((e=>({layerId:e.id,posterUrl:e.poster,sourceType:e.serviceType,title:e.name,type:e.type||"Video Layer"}))):[]}function E(t){return t&&t.has(s.EsriFrameCenterLatitude)&&t.has(s.EsriFrameCenterLongitude)?new e({x:t.get(s.EsriFrameCenterLongitude).value,y:t.get(s.EsriFrameCenterLatitude).value,z:t.get(s.FrameCenterElevation).value}):null}function S(t){return t&&t.has(s.FrameCenterLatitude)&&t.has(s.FrameCenterLongitude)?new e({x:t.get(s.FrameCenterLongitude)?.value,y:t.get(s.FrameCenterLatitude)?.value,z:t.get(s.FrameCenterElevation)?.value}):null}function v(e){if(!e)return null;const r=e.get(s.EsriFrameOutline)?.value;return r?t.fromJSON(r.geometry):h(e)??y(e)}function h(e){if(!(e.has(s.EsriCornerLatitudePt1)&&e.has(s.EsriCornerLongitudePt1)&&e.has(s.EsriCornerLatitudePt2)&&e.has(s.EsriCornerLongitudePt2)&&e.has(s.EsriCornerLatitudePt3)&&e.has(s.EsriCornerLongitudePt3)&&e.has(s.EsriCornerLatitudePt4)&&e.has(s.EsriCornerLongitudePt4)))return null;const r=[e.get(s.EsriCornerLongitudePt1)?.value,e.get(s.EsriCornerLatitudePt1)?.value],n=[e.get(s.EsriCornerLongitudePt2)?.value,e.get(s.EsriCornerLatitudePt2)?.value],i=[e.get(s.EsriCornerLongitudePt3)?.value,e.get(s.EsriCornerLatitudePt3)?.value],o=[e.get(s.EsriCornerLongitudePt4)?.value,e.get(s.EsriCornerLatitudePt4)?.value];return new t({rings:[[r,n,i,o]]})}function y(e){if(!(e.has(s.OffsetCorner1Latitude)&&e.has(s.OffsetCorner1Longitude)&&e.has(s.OffsetCorner2Latitude)&&e.has(s.OffsetCorner2Longitude)&&e.has(s.OffsetCorner3Latitude)&&e.has(s.OffsetCorner3Longitude)&&e.has(s.OffsetCorner4Latitude)&&e.has(s.OffsetCorner4Longitude)&&e.has(s.FrameCenterLatitude)&&e.has(s.FrameCenterLongitude)))return null;const r=e.get(s.FrameCenterLatitude)?.value,n=e.get(s.FrameCenterLongitude)?.value,i=r+e.get(s.OffsetCorner1Latitude)?.value,o=n+e.get(s.OffsetCorner1Longitude)?.value,a=r+e.get(s.OffsetCorner2Latitude)?.value,u=n+e.get(s.OffsetCorner2Longitude)?.value,l=r+e.get(s.OffsetCorner3Latitude)?.value,d=n+e.get(s.OffsetCorner3Longitude)?.value,g=r+e.get(s.OffsetCorner4Latitude)?.value,f=n+e.get(s.OffsetCorner4Longitude)?.value;return new t({rings:[[[o,i],[u,a],[d,l],[f,g]]]})}function p(e,t){if(!e||!t)return null;const n=[e.x,e.y,e.z??0],i=[t.x,t.y,t.z??0];return new r({paths:[[n,i]]})}function O(t){if(!t?.size)return null;if(t.has(s.EsriSensorPosition)){const r=t.get(s.EsriSensorPosition)?.value;if(r)return e.fromJSON(r.geometry)}return t.has(s.SensorLongitude)&&t.has(s.SensorLatitude)&&t.has(s.SensorTrueAltitude)?new e({x:t.get(s.SensorLongitude)?.value,y:t.get(s.SensorLatitude)?.value,z:t.get(s.SensorTrueAltitude)?.value}):null}export{m as getFrameCenter,C as getFrameHorizonPoints,L as getGroundControlPoints,g as getSensorTrailPoints,P as getServiceLayersInfo,f as getTelemetryData,l as getVideoMetadataFromCueList,c as getVideoMimeType,d as readVideoTimeExtent,s as videoMetadataEntryId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as u}from"./support/networkFieldUtils.js";import d from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import c from"./support/TraceJobInfo.js";import{AssociationTypeEnum as y,RuleType as p}from"./support/typeUtils.js";import{doesRuleAllowAssociation as f}from"./support/utils.js";import h from"../rest/support/Query.js";let I=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new d({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new c({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some((e=>f(e,r,s)))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:a,toNetworkSourceId:i,toGlobalId:n,toTerminalId:l,associationType:d,isContentVisible:m,percentAlong:c,globalId:p}=u(r);return{addFeatures:e.map((e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[a]:e.fromNetworkElement?.terminalId,[i]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[d]:y[e.associationType],[m]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[c]:e.percentAlong,[p]:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers;return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await b(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),b=s.get("VIATERMINALID"),g=r.attributes[o.name],T=new Date(r.attributes[a.name]),w=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[b.name]}];let S;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(S||(S={}));const k={ruleType:g,creationDate:T};for(const N of[S.from,S.to,S.via]){if(g!==p.RTEdgeJunctionEdgeConnectivity&&N===S.via)continue;const e=w[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case S.from:i="from";break;case S.to:i="to";break;case S.via:i="via"}k[`${i}NetworkSource`]=r,k[`${i}AssetGroup`]=s,k[`${i}AssetType`]=o,k[`${i}Terminal`]=a?.toJSON()}return k}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function b(e){const t=new h({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],I.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],I.prototype,"type",void 0),e([r({readOnly:!0})],I.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],I.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],I.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],I.prototype,"domainNetworkNames",null),I=e([s("esri.networks.UtilityNetwork")],I);const g=I;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import{getAssociationsTableFields as u}from"./support/networkFieldUtils.js";import d from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import c from"./support/TraceJobInfo.js";import{AssociationTypeEnum as y,RuleType as p}from"./support/typeUtils.js";import{doesRuleAllowAssociation as f}from"./support/utils.js";import h from"../rest/support/Query.js";let I=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new d({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers?.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new c({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;const{fromNetworkElement:r,toNetworkElement:s}=e;if(!r||!s)return!1;await t.load();let o=null;switch(e.associationType){case"containment":o=t.rulesCategorized.containment;break;case"attachment":o=t.rulesCategorized.attachment;break;default:o=t.rulesCategorized.connectivity}return o.some((e=>f(e,r,s)))}generateAddAssociations(e){const{associationsTable:r}=this.networkSystemLayers,{fromNetworkSourceId:s,fromGlobalId:o,fromTerminalId:a,toNetworkSourceId:i,toGlobalId:n,toTerminalId:l,associationType:d,isContentVisible:m,percentAlong:c,globalId:p}=u(r);return{addFeatures:e.map((e=>new t({attributes:{[s]:e.fromNetworkElement?.networkSourceId,[o]:e.fromNetworkElement?.globalId,[a]:e.fromNetworkElement?.terminalId,[i]:e.toNetworkElement?.networkSourceId,[n]:e.toNetworkElement?.globalId,[l]:e.toNetworkElement?.terminalId,[d]:y[e.associationType],[m]:null==e.isContentVisible?void 0:e.isContentVisible?1:0,[c]:e.percentAlong,[p]:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:r?.globalIdField??"globalid",objectIdField:r?.objectIdField??"objectid"}}}generateDeleteAssociations(e){const{associationsTable:t,associationsTableId:r}=this.networkSystemLayers;return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:r,identifierFields:{globalIdField:t?.globalIdField??"globalid",objectIdField:t?.objectIdField??"objectid"}}}async loadAssociationsTable(){return this.networkSystemLayers.loadAssociationsTable()}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await b(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),b=s.get("VIATERMINALID"),g=r.attributes[o.name],T=new Date(r.attributes[a.name]),w=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[b.name]}];let S;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(S||(S={}));const k={ruleType:g,creationDate:T};for(const N of[S.from,S.to,S.via]){if(g!==p.RTEdgeJunctionEdgeConnectivity&&N===S.via)continue;const e=w[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case S.from:i="from";break;case S.to:i="to";break;case S.via:i="via"}k[`${i}NetworkSource`]=r,k[`${i}AssetGroup`]=s,k[`${i}AssetType`]=o,k[`${i}Terminal`]=a?.toJSON()}return k}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function b(e){const t=new h({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],I.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],I.prototype,"type",void 0),e([r({readOnly:!0})],I.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],I.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],I.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],I.prototype,"domainNetworkNames",null),I=e([s("esri.networks.UtilityNetwork")],I);const g=I;export{g as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250417",
3
+ "version": "4.33.0-next.20250418",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
- "@esri/calcite-components": "^3.2.0-next.13",
29
+ "@esri/calcite-components": "^3.2.0-next.15",
30
30
  "@petamoriken/float16": "~3.9.2",
31
31
  "@vaadin/grid": "~24.7.3",
32
32
  "@zip.js/zip.js": "~2.7.60",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../config.js";import{id as s}from"../../kernel.js";import r from"../../request.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import o from"../../core/Identifiable.js";import n from"../../core/JSONSupport.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Loadable.js";import{throwIfAborted as p,throwIfAbortError as d}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as m}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../editing/sharedTemplates/SharedTemplateMetadata.js";import f from"../../geometry/SpatialReference.js";import{getFeatureJSON as g,getFeatureIds as v,getAttachmentEditsJSON as b,isProtectedOrPrivateVersionError as S,unpackEditResultData as E,createEditedFeatures as j}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as w,normalizeEdits as I,normalizeGeometries as F}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as R}from"../../layers/mixins/EditBusLayer.js";import{ensureCredentialIfSignedIn as A}from"../../layers/support/featureLayerUtils.js";import{getOwningPortalUrl as T}from"../../layers/support/layerUtils.js";import{getFeatureLayerCapabilities as U}from"../../layers/support/serviceCapabilitiesUtils.js";import C from"../../portal/PortalItem.js";import{getUserPrivileges as O}from"../../portal/support/portalItemUtils.js";import{isSecureProxyService as D}from"../../portal/support/urlUtils.js";import{parseUrl as P,asValidOptions as V,encode as k}from"../utils.js";import{unapplyEditsZUnitScaling as M}from"../query/operations/editsZScale.js";import{querySharedTemplates as N}from"../sharedTemplates/querySharedTemplates.js";import{readBoolean as q,readNumber as L}from"../support/jsonUtils.js";import{isSafeToEditVersion as _,isVersionInEditSession as x,currentSessionId as J}from"../../versionManagement/support/versionManagementUtils.js";function Q(e,t){const s=t.id;return{id:s,name:t.name,url:`${e}/${s}`,type:t.type||"Table"}}function W(e){return{data:H(e),sync:z(e),operations:B(e.capabilities,e),query:$(e),editing:G(e)}}function H(e){return{isDataVersioned:q(e,"hasVersionedData",!1),isDataBranchVersioned:q(e,"hasBranchVersionedData",!1)}}function B(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:q(t,"supportsQueryDataElements",!1),supportsQueryDomains:q(t,"supportsQueryDomains",!1),supportsQueryContingentValues:q(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function $(e){return{maxRecordCountFactor:L(e,"maxRecordCountFactor",void 0),maxRecordCount:L(e,"maxRecordCount",void 0)}}function G(e){const t=e?.advancedEditingCapabilities;return{supportsAsyncApplyEdits:q(t,"supportsAsyncApplyEdits",!1),supportsGlobalId:q(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:q(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSharedTemplates:q(e,"hasSharedTemplates",!1),supportsSplit:q(t,"supportsSplit",!1)}}function z(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:q(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:!(1&~s),dimensions:!(2&~s),contingentValues:!(4&~s),attributeRules:!(8&~s),utilityNetworkSystem:!(16&~s),annotationFullModel:!(32&~s),include3DObjects:!(64&~s),utilityNetworkMissingLayers:!(128&~s),preserveTrueCurves:!(256&~s)}}}let Z=class extends(n.JSONSupportMixin(o.IdentifiableMixin(u))){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1,this.userTypeExtensions=[],this.layerInfos=null,this.tableInfos=null,this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){if(this.sourceJSON)for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON?.hasBranchVersionedData&&!D(this.url)?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readLayerInfos(e,t){return(t.layers||[]).map((e=>{const{type:t,geometryType:s}=e;return{...Q(this.url,e),type:t||"Feature Layer",geometryType:s}}))}readTableInfos(e,t){return(t.tables||[]).map((e=>Q(this.url,e)))}readCapabilities(e,t){return W(t)}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=l(e),{operations:s}=t;return this.userHasUpdateItemPrivileges?(s.supportsAdd=s.supportsDelete=s.supportsEditing=s.supportsQuery=s.supportsUpdate=!0,t):(this.userHasFullEditingPrivileges&&s.supportsEditing&&(s.supportsAdd=s.supportsDelete=s.supportsUpdate=!0),t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e).then((()=>this._setUserPrivileges(e)))),Promise.resolve(this)}async fetchAllLayersAndTables(e){return await this.load(e),this._fetchLayersAndTablesPromise||=this._fetchLayersAndTables(this.url),p(e),this._fetchLayersAndTablesPromise}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),o=e=>e.filter((e=>!e.error)).map(l);let n=0;return r.map((e=>{s=R(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[n],addedFeatures:o(e.addFeatureResults),updatedFeatures:o(e.updateFeatureResults),deletedFeatures:o(e.deleteFeatureResults),addedAttachments:o(e.addAttachmentResults),updatedAttachments:o(e.updateAttachmentResults),deletedAttachments:o(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};n+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async querySharedTemplates(e){const t={...e?.query};null==t.layers&&null==t.templateIds&&(t.layers=this.layerInfos.map((e=>e.id)));return(await N({serviceUrl:this.url,query:t,requestOptions:e?.requestOptions})).map((e=>{const t=h.fromJSON(e);return t.featureService=this,t}))}async _setUserPrivileges(e){if(t.userPrivilegesApplied)try{const{features:{fullEdit:t},content:{updateItem:s}}=await this._fetchUserPrivileges(this.sourceJSON.serviceItemId,e);this._set("userHasFullEditingPrivileges",t),this._set("userHasUpdateItemPrivileges",s)}catch(s){d(s)}}async _fetchUserPrivileges(e,t){const r=!0,i=!1,a=!1;if(!e)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};let o,n,l;try{o=await T(this.url,t)}catch(u){d(u)}try{const e=null!=t?t.signal:null;n=await(s?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(u){d(u)}if(!n)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};try{if(l=new C({id:e,portal:{url:o}}),await l.load(t),l.portal.user)return O(l)}catch(u){d(u)}return{features:{edit:r,fullEdit:i},content:{updateItem:a}}}async _internalApplyEdits(e,t){await A(this.url);const s=t?.globalIdUsed??!1,a=f.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,t),l=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>g({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(i),o=r.length>0?r:null,n=e.updateFeatures?.map((e=>g({spatialReference:a},e,null)))??[],l=(await Promise.all(n)).filter(i),u=l.length>0?l:null,p=v(e.identifierFields,e.deleteFeatures,s),d=p.length>0?p:null;M(o,u,a);const c=await b(e.identifierFields,e);let m=null;if(c){m={adds:c.adds.length>0?c.adds:void 0,updates:c.updates.length>0?c.updates:void 0,deletes:c.deletes.length>0?c.deletes:void 0}}return{id:e.id,adds:o,updates:u,deletes:d,attachments:m}}))),u={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:s,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:!1,returnServiceEditsOption:"originalAndCurrentFeatures",async:!1};await _(this.url,t?.gdbVersion,!0);const p=x(this.url,t?.gdbVersion||null);u.edits=JSON.stringify(l);const d=P(this.url),c=V(d.query,{query:k({...u,f:"json"}),method:"post"});let m;p&&(c.authMode="immediate",c.query.sessionId=J);try{m=await r(this.url+"/applyEdits",c)}catch(y){if(!S(y))throw y;c.authMode="immediate",m=await r(this.url+"/applyEdits",c)}return{...K(m),edits:o}}async _processApplyEditsParams(e,t){const s={...t,usingFeatureServiceEndpoint:!0};return{edits:await Promise.all(e.map((async e=>{const t=this.effectiveCapabilities,r=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),i=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(w(e,t,s,!!r,!!i,"feature-service"),!t.data.isDataVersioned&&s?.gdbVersion)throw new a("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isDataVersioned'");const o=I(e,t,"feature-service");return{...await F(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,t){if(this.sourceJSON)return void this.read(this.sourceJSON,{url:P(e)});const s=await r(e,{responseType:"json",query:{f:"json"},...t});this.read(s.data,{url:P(e)})}async _fetchLayersAndTables(e){const t=`${e}/layers`,s=await r(t,{responseType:"json",query:{f:"json"}});return{layers:s.data.layers.map((e=>{const{type:t,geometryType:s}=e,r=Q(this.url,e),i=U(e,r.url);return{...r,type:t||"Feature Layer",geometryType:s,capabilities:i}})),tables:s.data.tables.map((e=>{const t=Q(this.url,e),s=U(e,t.url);return{...t,capabilities:s}}))}}};function K(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=E(t),i=e.editedFeatures,a=i?.spatialReference?new f({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?j(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}e([c()],Z.prototype,"url",void 0),e([c()],Z.prototype,"sourceJSON",void 0),e([c()],Z.prototype,"userHasFullEditingPrivileges",void 0),e([c()],Z.prototype,"userHasUpdateItemPrivileges",void 0),e([c({readOnly:!0})],Z.prototype,"utilityNetworkUrl",null),e([c({readOnly:!0})],Z.prototype,"versionManagementServiceUrl",null),e([c()],Z.prototype,"userTypeExtensions",void 0),e([c({json:{read:{source:["layers"]}}})],Z.prototype,"layerInfos",void 0),e([m("layerInfos",["layers"])],Z.prototype,"readLayerInfos",null),e([c({json:{read:{source:["tables"]}}})],Z.prototype,"tableInfos",void 0),e([m("tableInfos",["tables"])],Z.prototype,"readTableInfos",null),e([c({readOnly:!0,json:{read:{source:["hasVersionedData","hasSharedTemplates","hasBranchVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],Z.prototype,"capabilities",void 0),e([m("capabilities",["hasVersionedData","hasSharedTemplates","hasBranchVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"])],Z.prototype,"readCapabilities",null),e([c({readOnly:!0})],Z.prototype,"effectiveCapabilities",null),Z=e([y("esri.rest.featureService.FeatureService")],Z);const X=Z;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../config.js";import{id as s}from"../../kernel.js";import r from"../../request.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import o from"../../core/Identifiable.js";import n from"../../core/JSONSupport.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Loadable.js";import{throwIfAborted as p,throwIfAbortError as d}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as m}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../editing/sharedTemplates/SharedTemplateMetadata.js";import f from"../../geometry/SpatialReference.js";import{getFeatureJSON as g,getFeatureIds as v,getAttachmentEditsJSON as b,isProtectedOrPrivateVersionError as S,unpackEditResultData as E,createEditedFeatures as j}from"../../layers/graphics/applyEditsUtils.js";import{checkEditingCapabilities as w,normalizeEdits as I,normalizeGeometries as F}from"../../layers/graphics/editingSupport.js";import{emitApplyEditsEvent as R}from"../../layers/mixins/EditBusLayer.js";import{ensureCredentialIfSignedIn as A}from"../../layers/support/featureLayerUtils.js";import{getOwningPortalUrl as T}from"../../layers/support/layerUtils.js";import{getFeatureLayerCapabilities as U}from"../../layers/support/serviceCapabilitiesUtils.js";import C from"../../portal/PortalItem.js";import{getUserPrivileges as O}from"../../portal/support/portalItemUtils.js";import{isSecureProxyService as D}from"../../portal/support/urlUtils.js";import{parseUrl as P,asValidOptions as V,encode as k}from"../utils.js";import{unapplyEditsZUnitScaling as M}from"../query/operations/editsZScale.js";import{querySharedTemplates as N}from"../sharedTemplates/querySharedTemplates.js";import{readBoolean as q,readNumber as L}from"../support/jsonUtils.js";import{isSafeToEditVersion as _,isVersionInEditSession as x,currentSessionId as J}from"../../versionManagement/support/versionManagementUtils.js";function Q(e,t){const s=t.id;return{id:s,name:t.name,url:`${e}/${s}`,type:t.type||"Table"}}function W(e){return{data:H(e),sync:z(e),operations:B(e.capabilities,e),query:$(e),editing:G(e)}}function H(e){return{isDataVersioned:q(e,"hasVersionedData",!1),isDataBranchVersioned:q(e,"hasBranchVersionedData",!1)}}function B(e,t){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],r=s.includes("query"),i=s.includes("editing")&&!t.datesInUnknownTimezone;let a=i&&s.includes("create"),o=i&&s.includes("delete"),n=i&&s.includes("update");return i&&!(a||o||n)&&(a=o=n=!0),{supportsAdd:a,supportsDelete:o,supportsEditing:i,supportsChangeTracking:s.includes("changetracking"),supportsQuery:r,supportsQueryDataElements:q(t,"supportsQueryDataElements",!1),supportsQueryDomains:q(t,"supportsQueryDomains",!1),supportsQueryContingentValues:q(t,"supportsQueryContingentValues",!1),supportsSync:s.includes("sync"),supportsUpdate:n}}function $(e){return{maxRecordCountFactor:L(e,"maxRecordCountFactor",void 0),maxRecordCount:L(e,"maxRecordCount",void 0)}}function G(e){const t=e?.advancedEditingCapabilities;return{supportsAsyncApplyEdits:q(t,"supportsAsyncApplyEdits",!1),supportsGlobalId:q(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:q(t,"supportsReturnServiceEditsInSourceSR",!1),supportsSharedTemplates:q(e,"supportsSharedTemplates",!1)||q(e,"hasSharedTemplates",!1),supportsSplit:q(t,"supportsSplit",!1)}}function z(e){const t=e?.syncCapabilities,s=t?.supportedSyncDataOptions;return{supportsAsync:q(t,"supportsAsync",!1),supportedSyncDataOptions:{annotations:!(1&~s),dimensions:!(2&~s),contingentValues:!(4&~s),attributeRules:!(8&~s),utilityNetworkSystem:!(16&~s),annotationFullModel:!(32&~s),include3DObjects:!(64&~s),utilityNetworkMissingLayers:!(128&~s),preserveTrueCurves:!(256&~s)}}}let Z=class extends(n.JSONSupportMixin(o.IdentifiableMixin(u))){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1,this.userTypeExtensions=[],this.layerInfos=null,this.tableInfos=null,this.capabilities=null}read(e,t){this.sourceJSON=e,super.read(e,t)}get utilityNetworkUrl(){if(this.sourceJSON)for(const e of this.sourceJSON.layers)if("Utility Network Layer"===e.type)return`${this.url}/${e.id}`;return null}get versionManagementServiceUrl(){return this.sourceJSON?.hasBranchVersionedData&&!D(this.url)?this.url.replace(/\/FeatureServer/i,"/VersionManagementServer"):null}readLayerInfos(e,t){return(t.layers||[]).map((e=>{const{type:t,geometryType:s}=e;return{...Q(this.url,e),type:t||"Feature Layer",geometryType:s}}))}readTableInfos(e,t){return(t.tables||[]).map((e=>Q(this.url,e)))}readCapabilities(e,t){return W(t)}get effectiveCapabilities(){const e=this.capabilities;if(!e)return null;const t=l(e),{operations:s}=t;return this.userHasUpdateItemPrivileges?(s.supportsAdd=s.supportsDelete=s.supportsEditing=s.supportsQuery=s.supportsUpdate=!0,t):(this.userHasFullEditingPrivileges&&s.supportsEditing&&(s.supportsAdd=s.supportsDelete=s.supportsUpdate=!0),t)}load(e){return this.addResolvingPromise(this._fetchService(this.url,e).then((()=>this._setUserPrivileges(e)))),Promise.resolve(this)}async fetchAllLayersAndTables(e){return await this.load(e),this._fetchLayersAndTablesPromise||=this._fetchLayersAndTables(this.url),p(e),this._fetchLayersAndTablesPromise}async applyEdits(e,t){let s=null;try{const{results:r,edits:i,editedFeatures:a}=await this._internalApplyEdits(e,t),o=e=>e.filter((e=>!e.error)).map(l);let n=0;return r.map((e=>{s=R(this.url,e.id,t?.gdbVersion,!0);const r={edits:i[n],addedFeatures:o(e.addFeatureResults),updatedFeatures:o(e.updateFeatureResults),deletedFeatures:o(e.deleteFeatureResults),addedAttachments:o(e.addAttachmentResults),updatedAttachments:o(e.updateAttachmentResults),deletedAttachments:o(e.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:e.editMoment?new Date(e.editMoment):null};n+=1,a.length>0&&(r.editedFeatures=a),s.resolve(r),s=null})),r}catch(r){throw s&&s.reject(r),r}}async querySharedTemplates(e){const t={...e?.query};null==t.layers&&null==t.templateIds&&(t.layers=this.layerInfos.map((e=>e.id)));return(await N({serviceUrl:this.url,query:t,requestOptions:e?.requestOptions})).map((e=>{const t=h.fromJSON(e);return t.featureService=this,t}))}async _setUserPrivileges(e){if(t.userPrivilegesApplied)try{const{features:{fullEdit:t},content:{updateItem:s}}=await this._fetchUserPrivileges(this.sourceJSON.serviceItemId,e);this._set("userHasFullEditingPrivileges",t),this._set("userHasUpdateItemPrivileges",s)}catch(s){d(s)}}async _fetchUserPrivileges(e,t){const r=!0,i=!1,a=!1;if(!e)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};let o,n,l;try{o=await T(this.url,t)}catch(u){d(u)}try{const e=null!=t?t.signal:null;n=await(s?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(u){d(u)}if(!n)return{features:{edit:r,fullEdit:i},content:{updateItem:a}};try{if(l=new C({id:e,portal:{url:o}}),await l.load(t),l.portal.user)return O(l)}catch(u){d(u)}return{features:{edit:r,fullEdit:i},content:{updateItem:a}}}async _internalApplyEdits(e,t){await A(this.url);const s=t?.globalIdUsed??!1,a=f.fromJSON(this.sourceJSON.spatialReference),{edits:o,options:n}=await this._processApplyEditsParams(e,t),l=await Promise.all(o.map((async e=>{const t=e.addFeatures?.map((e=>g({spatialReference:a},e,null)))??[],r=(await Promise.all(t)).filter(i),o=r.length>0?r:null,n=e.updateFeatures?.map((e=>g({spatialReference:a},e,null)))??[],l=(await Promise.all(n)).filter(i),u=l.length>0?l:null,p=v(e.identifierFields,e.deleteFeatures,s),d=p.length>0?p:null;M(o,u,a);const c=await b(e.identifierFields,e);let m=null;if(c){m={adds:c.adds.length>0?c.adds:void 0,updates:c.updates.length>0?c.updates:void 0,deletes:c.deletes.length>0?c.deletes:void 0}}return{id:e.id,adds:o,updates:u,deletes:d,attachments:m}}))),u={gdbVersion:n?.gdbVersion,rollbackOnFailure:!0,useGlobalIds:s,returnEditMoment:!0,honorSequenceOfEdits:n?.honorSequenceOfEdits,usePreviousEditMoment:n?.usePreviousEditMoment,returnServiceEditsInSourceSR:!1,returnServiceEditsOption:"originalAndCurrentFeatures",async:!1};await _(this.url,t?.gdbVersion,!0);const p=x(this.url,t?.gdbVersion||null);u.edits=JSON.stringify(l);const d=P(this.url),c=V(d.query,{query:k({...u,f:"json"}),method:"post"});let m;p&&(c.authMode="immediate",c.query.sessionId=J);try{m=await r(this.url+"/applyEdits",c)}catch(y){if(!S(y))throw y;c.authMode="immediate",m=await r(this.url+"/applyEdits",c)}return{...K(m),edits:o}}async _processApplyEditsParams(e,t){const s={...t,usingFeatureServiceEndpoint:!0};return{edits:await Promise.all(e.map((async e=>{const t=this.effectiveCapabilities,r=e&&(e.addFeatures||e.updateFeatures||e.deleteFeatures),i=e&&(e.addAttachments||e.updateAttachments||e.deleteAttachments);if(w(e,t,s,!!r,!!i,"feature-service"),!t.data.isDataVersioned&&s?.gdbVersion)throw new a("feature-service:invalid-parameter","'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isDataVersioned'");const o=I(e,t,"feature-service");return{...await F(o),id:e.id,identifierFields:e.identifierFields}}))),options:s}}async _fetchService(e,t){if(this.sourceJSON)return void this.read(this.sourceJSON,{url:P(e)});const s=await r(e,{responseType:"json",query:{f:"json"},...t});this.read(s.data,{url:P(e)})}async _fetchLayersAndTables(e){const t=`${e}/layers`,s=await r(t,{responseType:"json",query:{f:"json"}});return{layers:s.data.layers.map((e=>{const{type:t,geometryType:s}=e,r=Q(this.url,e),i=U(e,r.url);return{...r,type:t||"Feature Layer",geometryType:s,capabilities:i}})),tables:s.data.tables.map((e=>{const t=Q(this.url,e),s=U(e,t.url);return{...t,capabilities:s}}))}}};function K(e){const t=e.data,s=[];return{results:t.map((e=>{const t={addResults:e.addResults??[],updateResults:e.updateResults??[],deleteResults:e.deleteResults??[],attachments:e.attachments,editMoment:e.editMoment},r=E(t),i=e.editedFeatures,a=i?.spatialReference?new f({wkid:i?.spatialReference.wkid,wkt:i?.spatialReference.wkt,latestWkid:i?.spatialReference.latestWkid,latestVcsWkid:i?.spatialReference.latestVcsWkid,vcsWkid:i?.spatialReference.vcsWkid}):null,o=i?j(i,a):null;return o&&s.push({layerId:e.id,editedFeatures:o}),{id:e.id,editedFeatures:o,...r}})),editedFeatures:s}}e([c()],Z.prototype,"url",void 0),e([c()],Z.prototype,"sourceJSON",void 0),e([c()],Z.prototype,"userHasFullEditingPrivileges",void 0),e([c()],Z.prototype,"userHasUpdateItemPrivileges",void 0),e([c({readOnly:!0})],Z.prototype,"utilityNetworkUrl",null),e([c({readOnly:!0})],Z.prototype,"versionManagementServiceUrl",null),e([c()],Z.prototype,"userTypeExtensions",void 0),e([c({json:{read:{source:["layers"]}}})],Z.prototype,"layerInfos",void 0),e([m("layerInfos",["layers"])],Z.prototype,"readLayerInfos",null),e([c({json:{read:{source:["tables"]}}})],Z.prototype,"tableInfos",void 0),e([m("tableInfos",["tables"])],Z.prototype,"readTableInfos",null),e([c({readOnly:!0,json:{read:{source:["hasVersionedData","hasSharedTemplates","hasBranchVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"]}}})],Z.prototype,"capabilities",void 0),e([m("capabilities",["hasVersionedData","hasSharedTemplates","hasBranchVersionedData","capabilities","supportsQueryDataElements","supportsQueryDomains","supportsQueryContingentValues","maxRecordCountFactor","maxRecordCount","advancedEditingCapabilities","supportsApplyEditsWithGlobalIds","syncCapabilities","datesInUnknownTimezone"])],Z.prototype,"readCapabilities",null),e([c({readOnly:!0})],Z.prototype,"effectiveCapabilities",null),Z=e([y("esri.rest.featureService.FeatureService")],Z);const X=Z;export{X as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import t from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.assetGroupCode=null,this.assetTypeCode=null,this.globalId=null,this.networkSourceId=null,this.objectId=null,this.positionFrom=null,this.positionTo=null,this.terminalId=null}};o([e({type:Number,json:{write:!0}})],s.prototype,"assetGroupCode",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"assetTypeCode",void 0),o([e({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"networkSourceId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"objectId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"positionFrom",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"positionTo",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"terminalId",void 0),s=o([r("esri.rest.networks.support.NetworkElement")],s);const p=s;export{p as default};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import t from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.type="networkElement",this.assetGroupCode=null,this.assetTypeCode=null,this.globalId=null,this.networkSourceId=null,this.objectId=null,this.positionFrom=null,this.positionTo=null,this.terminalId=null}};o([e({json:{write:!1}})],s.prototype,"type",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"assetGroupCode",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"assetTypeCode",void 0),o([e({type:String,json:{write:!0}})],s.prototype,"globalId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"networkSourceId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"objectId",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"positionFrom",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"positionTo",void 0),o([e({type:Number,json:{write:!0}})],s.prototype,"terminalId",void 0),s=o([r("esri.rest.networks.support.NetworkElement")],s);const p=s;export{p as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import e from"./NetworkElement.js";let s=class extends e{constructor(t){super(t),this.type="telecomNetworkElement",this.firstUnit=null,this.numUnits=null,this.nextUnitId=null}};t([o({json:{write:!1}})],s.prototype,"type",void 0),t([o({json:{write:!0}})],s.prototype,"firstUnit",void 0),t([o({json:{write:!0}})],s.prototype,"numUnits",void 0),t([o({json:{write:!0}})],s.prototype,"nextUnitId",void 0),s=t([r("esri.rest.networks.support.TelecomNetworkElement")],s);export{e as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const e="20250417",a="24b0d64223a7221d25133eae89073f5890f17e94";export{e as buildDate,a as commitHash};
5
+ const b="20250418",c="11092910bdd5b9b2c94fd073c1560fb7b896a8af";export{b as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as i}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as r,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as n,RESHUFFLING_EXEMPT_DRAW_CALLS as o,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as h}from"./definitions.js";import a from"./DisplayEntity.js";import{FeatureBatchingStrategy as l}from"./enums.js";import{DisplayList as c}from"./FeatureDisplayList.js";import{ReshufflePlan as f}from"./ReshufflePlan.js";import{LabelMetric as u}from"./collisions/LabelMetric.js";import{MappedMesh as _}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as m}from"./mesh/meshDebugUtils.js";import p from"./util/Reader.js";import{deserializeList as y}from"./util/serializationUtils.js";const g=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let b=0;class I extends i{constructor(e,i,r,n,o,d,h=!1){super(e,i,r,n),this._fader=o,this._labelInstanceId=d,this._meshes=new Map,this._entities=[],this._entityIndex=new Map,this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=b++,this._metrics=[],this._clearedMetrics=[],this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this.neededForCoverage=!1,this.isCoverage=!1,this.rendering=!1,this._decluttered=!1,this._objectIdMap=null,this.visible=!0,this.transforms.labelMat2d=t(),this.transforms.tileUnitsToPixels=s(),this.enableDeferredUploads=h}destroy(){super.destroy(),this.clear(),this._finalizeMetricClear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._clearedMetrics=this._metrics,this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this.isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),this.decluttered=!1,!0)}get decluttered(){return this._decluttered}set decluttered(e){this._decluttered=e,this.requestRender()}get id(){return this.key.id}get hasData(){return!!this._meshes.size}get hasAnimations(){return!!this._objectIdMap}get needsUpload(){return this._invalidated}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}get _hasMetrics(){return this._metrics.length>0}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t){if(this._uploadAllowed&&this._invalidated){this._entities.sort(((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s})),t===l.BATCHING&&this.reshuffle(!0),this._displayList=c.fromDisplayEntities(this._entities,this,e,t);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return this._meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this._entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}onMessage(e){if(e.objectIdMap)for(const t in e.objectIdMap)this._objectIdMap||(this._objectIdMap={}),this._objectIdMap[t]=e.objectIdMap[t];switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}this.writeLabelVisibility()}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:m(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=y(new p(e.append.entities),a);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:m(e.modify),remove:e.remove});const t=y(new p(e.modify.entities),a),s=t.map((e=>e.id)),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new f(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&g().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*h,n=i*h;for(const o of e._entities){let s=null;for(const i of o.records)if(i.overlaps&t){const t=e.getMesh(i.instanceId),d=this._ensureMesh(i.instanceId,t.layout,t.useVisibility).copyRecordFrom(t,i,r,n);s||(s=new a(o.id,o.sortKey),this._entityIdsFromBuffer.add(o.id),this._entityIndex.set(s.id,s),this._entities.push(s)),s.records.push(d)}}this._invalidated=!0}writeLabelVisibility(){if(this._clearedMetrics.length)return this._finalizeMetricClear();const e=this._meshes.get(this._labelInstanceId);if(e&&this._hasMetrics){for(const t of this._metrics){const s=this._entityIndex.get(t.entityTexel);if(!s)continue;const i=t.uniqueSymbol.show&&t.selectedForRendering;e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}this._invalidated=!0}}_ensureMesh(e,t,s){return this._meshes.has(e)||this._meshes.set(e,new _(this._stage.bufferPool,t,s)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertMetrics(e){for(const t of e)t.tile=this;this._metrics.push(...e),this._fader?.insertFeatureTileMetrics(this,e)}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e,layout:i}=s,r=i.attributes.some((e=>"visibility"===e.name)),n=this._ensureMesh(e,i,r).append(s);if(s.metrics){const e=y(new p(s.metrics),u)??[];this._insertMetrics(e)}t.set(e,n)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} insertEntity: Already have entityId ${e.id}`),this._entityIds.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e)}_tryInsertBufferedEntity(e){this._entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this._entityIdsFromBuffer.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e))}_removeDuplicatedBufferedEntites(e){if(!this._entityIdsFromBuffer.size)return;const t=[];for(const s of e)this._entityIdsFromBuffer.has(s.id)&&t.push(s.id);this._removeByIds(t)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter((e=>this._entityIdsFromBuffer.has(e))))}_removeByIds(e){if(0===e.length)return;const t=new Set(e),s=[];for(const r of this._entities)t.has(r.id)?(this._remove(r),this._entityIndex.delete(r.id)):s.push(r);const i=[];for(const r of this._metrics)t.has(r.entityTexel)?this._clearedMetrics.push(r):i.push(r);this._entities=s,this._metrics=i,this._invalidated=!0}_remove(e){this._removeRecordsFromMesh(e.records),this._entityIds.delete(e.id),this._entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:n}=t;this._meshes.get(e)?.remove(s,i,r,n)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:i,length:h}=this.debugInfo.display;return t>r&&s<n||h>o&&i/h<d}get entityIds(){return this._objectIdMap?this._entities.map((({id:e})=>({objectId:this._objectIdMap[e],displayId:e}))):[]}_finalizeMetricClear(){if(!this._clearedMetrics.length)return;this._fader.removeFeatureTileMetrics(this,this._clearedMetrics),this._clearedMetrics.length=0,this._invalidated=!0;const e=this._meshes.get(this._labelInstanceId);if(e)for(const t of this._metrics){const s=this._entityIndex.get(t.entityTexel);if(!s)continue;const i=t.uniqueSymbol.show&&t.uniqueSymbol.tileSymbols.some((e=>e.selectedForRendering&&e.tile.key.equals(this.key)));e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}}}export{I as FeatureTile};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as i}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as r,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as n,RESHUFFLING_EXEMPT_DRAW_CALLS as o,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as h}from"./definitions.js";import a from"./DisplayEntity.js";import{FeatureBatchingStrategy as l}from"./enums.js";import{DisplayList as c}from"./FeatureDisplayList.js";import{ReshufflePlan as f}from"./ReshufflePlan.js";import{LabelMetric as u}from"./collisions/LabelMetric.js";import{MappedMesh as _}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as m}from"./mesh/meshDebugUtils.js";import p from"./util/Reader.js";import{deserializeList as y}from"./util/serializationUtils.js";const g=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let b=0;class I extends i{constructor(e,i,r,n,o,d,h=!1){super(e,i,r,n),this._fader=o,this._labelInstanceId=d,this._meshes=new Map,this._entities=[],this._entityIndex=new Map,this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=b++,this._metrics=[],this._clearedMetrics=[],this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this.neededForCoverage=!1,this.isCoverage=!1,this.rendering=!1,this._decluttered=!1,this._objectIdMap=null,this.visible=!0,this.transforms.labelMat2d=t(),this.transforms.tileUnitsToPixels=s(),this.enableDeferredUploads=h}destroy(){super.destroy(),this.clear(),this._finalizeMetricClear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._clearedMetrics=this._metrics,this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this.isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),this.decluttered=!1,!0)}get decluttered(){return this._decluttered}set decluttered(e){this._decluttered=e,this.requestRender()}get id(){return this.key.id}get hasData(){return!!this._meshes.size}get hasAnimations(){return!!this._objectIdMap}get needsUpload(){return this._invalidated}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}get _hasMetrics(){return this._metrics.length>0}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t){if(this._uploadAllowed&&this._invalidated){this._entities.sort(((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s})),t===l.BATCHING&&this.reshuffle(!0),this._displayList=c.fromDisplayEntities(this._entities,this,e,t);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return this._meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this._entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}onMessage(e){if(e.objectIdMap)for(const t in e.objectIdMap)this._objectIdMap||(this._objectIdMap={}),this._objectIdMap[t]=e.objectIdMap[t];switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}this.writeLabelVisibility()}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:m(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=y(new p(e.append.entities),a);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:m(e.modify),remove:e.remove});const t=y(new p(e.modify.entities),a),s=t.map((e=>e.id)),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new f(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&g().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*h,n=i*h;for(const o of e._entities){let s=null;for(const i of o.records)if(i.overlaps&t){const t=e.getMesh(i.instanceId),d=this._ensureMesh(i.instanceId,t.layout,t.useVisibility).copyRecordFrom(t,i,r,n);s||(s=new a(o.id,o.sortKey),this._entityIdsFromBuffer.add(o.id),this._entityIndex.set(s.id,s),this._entities.push(s)),s.records.push(d)}}this._invalidated=!0}writeLabelVisibility(){if(this._clearedMetrics.length)return this._finalizeMetricClear();const e=this._meshes.get(this._labelInstanceId);if(e&&this._hasMetrics){for(const t of this._metrics){const s=this._entityIndex.get(t.featureID);if(!s)continue;const i=t.uniqueSymbol.show&&t.selectedForRendering;e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}this._invalidated=!0}}_ensureMesh(e,t,s){return this._meshes.has(e)||this._meshes.set(e,new _(this._stage.bufferPool,t,s)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertMetrics(e){for(const t of e)t.tile=this;this._metrics.push(...e),this._fader?.insertFeatureTileMetrics(this,e)}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e,layout:i}=s,r=i.attributes.some((e=>"visibility"===e.name)),n=this._ensureMesh(e,i,r).append(s);if(s.metrics){const e=y(new p(s.metrics),u)??[];this._insertMetrics(e)}t.set(e,n)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} insertEntity: Already have entityId ${e.id}`),this._entityIds.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e)}_tryInsertBufferedEntity(e){this._entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this._entityIdsFromBuffer.add(e.id),this._entityIndex.set(e.id,e),this._entities.push(e))}_removeDuplicatedBufferedEntites(e){if(!this._entityIdsFromBuffer.size)return;const t=[];for(const s of e)this._entityIdsFromBuffer.has(s.id)&&t.push(s.id);this._removeByIds(t)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter((e=>this._entityIdsFromBuffer.has(e))))}_removeByIds(e){if(0===e.length)return;const t=new Set(e),s=[];for(const r of this._entities)t.has(r.id)?(this._remove(r),this._entityIndex.delete(r.id)):s.push(r);const i=[];for(const r of this._metrics)t.has(r.featureID)?this._clearedMetrics.push(r):i.push(r);this._entities=s,this._metrics=i,this._invalidated=!0}_remove(e){this._removeRecordsFromMesh(e.records),this._entityIds.delete(e.id),this._entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:n}=t;this._meshes.get(e)?.remove(s,i,r,n)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:i,length:h}=this.debugInfo.display;return t>r&&s<n||h>o&&i/h<d}get entityIds(){return this._objectIdMap?this._entities.map((({id:e})=>({objectId:this._objectIdMap[e],displayId:e}))):[]}_finalizeMetricClear(){if(!this._clearedMetrics.length)return;this._fader.removeFeatureTileMetrics(this,this._clearedMetrics),this._clearedMetrics.length=0,this._invalidated=!0;const e=this._meshes.get(this._labelInstanceId);if(e)for(const t of this._metrics){const s=this._entityIndex.get(t.featureID);if(!s)continue;const i=t.uniqueSymbol.show&&t.uniqueSymbol.tileSymbols.some((e=>e.selectedForRendering&&e.tile.key.equals(this.key)));e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}}}export{I as FeatureTile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{numericHash as e}from"../../../../../core/string.js";import{labelPlacementOffsetPadding as i}from"../definitions.js";import{VVBinding as t}from"../enums.js";import r from"./BoundingBox.js";import{serializeList as s,deserializeList as n}from"../util/serializationUtils.js";const o=2;class h{constructor(i,t,r,s,n,o,h,a,l,c=[],d=0,u=0){this.entityTexel=i,this.labelClassId=t,this.anchorX=r,this.anchorY=s,this.directionX=n,this.directionY=o,this.maxScale=h,this.minScale=a,this.referenceBounds=l,this.bounds=c,this.recordStart=d,this.recordCount=u,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1,this.hash=e(`${i} ${t}`)}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(e){if(!this._colliders){const r=e.attributeView,s=i;let n=this.referenceBounds?.size??0;const h=e.layerView.labelingCollisionInfos[0].vvEvaluators[0];if(null!=h){const e=h(r.getVisualVariableData(this.entityTexel,t.SIZE));n=isNaN(e)||null==e||e===1/0?n:e}const a=this.minScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.minScale):0,l=this.maxScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.maxScale):25,c=this.directionX*(s+n/2),d=this.directionY*(s+n/2);this._colliders=this.bounds.map((e=>({xTile:this.anchorX,yTile:this.anchorY,dxPixels:e.x-e.halfWidth+c,dyPixels:e.y-e.halfHeight+d,hard:!0,partIndex:1,width:e.width+o,height:e.height+o,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:a,maxLod:l})))}return this._colliders}get featureID(){return this.entityTexel}serialize(e){e.push(this.entityTexel),e.push(this.labelClassId),e.push(this.recordStart),e.push(this.recordCount),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),null===this.referenceBounds?(e.writeF32(0),e.writeF32(0),e.writeF32(0)):(e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY)),s(e,this.bounds)}static deserialize(e){const i=e.readInt32(),t=e.readInt32(),s=e.readInt32(),o=e.readInt32(),a=e.readF32(),l=e.readF32(),c=e.readF32(),d=e.readF32(),u=e.readF32(),f=e.readF32(),m=e.readF32(),F=e.readF32(),w=e.readF32(),x=n(e,r)??[];return new h(i,t,a,l,c,d,u,f,{size:m,offsetX:F,offsetY:w},x,s,o)}}export{h as LabelMetric};
5
+ import{numericHash as e}from"../../../../../core/string.js";import{labelPlacementOffsetPadding as i}from"../definitions.js";import{VVBinding as t}from"../enums.js";import s from"./BoundingBox.js";import{serializeList as r,deserializeList as n}from"../util/serializationUtils.js";const a=2;class h{constructor(i,t,s,r,n,a,h,o,l,d,c=[],u=0,f=0){this.displayId=i,this.labelId=t,this.labelClassId=s,this.anchorX=r,this.anchorY=n,this.directionX=a,this.directionY=h,this.maxScale=o,this.minScale=l,this.referenceBounds=d,this.bounds=c,this.recordStart=u,this.recordCount=f,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1,this.hash=e(`${i}${t}${s}`)}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(e){if(!this._colliders){const s=e.attributeView,r=i;let n=this.referenceBounds?.size??0;const h=e.layerView.labelingCollisionInfos[0].vvEvaluators[0];if(null!=h){const e=h(s.getVisualVariableData(this.displayId,t.SIZE));n=isNaN(e)||null==e||e===1/0?n:e}const o=this.minScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.minScale):0,l=this.maxScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.maxScale):25,d=this.directionX*(r+n/2),c=this.directionY*(r+n/2);this._colliders=this.bounds.map((e=>({xTile:this.anchorX,yTile:this.anchorY,dxPixels:e.x-e.halfWidth+d,dyPixels:e.y-e.halfHeight+c,hard:!0,partIndex:1,width:e.width+a,height:e.height+a,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:o,maxLod:l})))}return this._colliders}get featureID(){return this.displayId}serialize(e){e.push(this.displayId),e.push(this.labelId),e.push(this.labelClassId),e.push(this.recordStart),e.push(this.recordCount),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),this.referenceBounds?(e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY)):(e.writeF32(0),e.writeF32(0),e.writeF32(0)),r(e,this.bounds)}static deserialize(e){const i=e.readInt32(),t=e.readInt32(),r=e.readInt32(),a=e.readInt32(),o=e.readInt32(),l=e.readF32(),d=e.readF32(),c=e.readF32(),u=e.readF32(),f=e.readF32(),m=e.readF32(),F=e.readF32(),w=e.readF32(),p=e.readF32(),S=n(e,s)??[];return new h(i,t,r,l,d,c,u,f,m,{size:F,offsetX:w,offsetY:p},S,a,o)}}export{h as LabelMetric};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as n,sub as a,normalize as l,add as c,scale as h}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as u,convertToGeometry as f}from"../../../../../../../layers/graphics/featureConversionUtils.js";import g from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as p,minMaxZoomPrecisionFactor as _}from"../../../definitions.js";import{getDisplayIdTexel as b}from"../../../DisplayId.js";import M from"../../../collisions/BoundingBox.js";import{LabelMetric as x}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as P,processColorInput as w}from"../fill/meshWriterUtils.js";import{TextMeshWriter as L,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,D=128,I=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class A extends L{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,s){const r=b(e),[o,n]=this._getMetricDir(),a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=this.evaluatedMeshParams.labelClassId;return new x(r,c,t,i,o,n,a,l,s??null)}_writePoint(e,t,i,s){if(t<0||t>p||i<0||i>p)return;const r=this._getShaping();if(!r)return;const o=s.getDisplayId(),n=this.evaluatedMeshParams.labelClassId,[a,l]=this._getMetricDir(),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,m=b(s.getDisplayId()),d=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new x(m,n,t,i,a,l,c,h,d)),this._writeGlyphs(e,o,t,i,r,0,d,void 0,!1),e.metricBoxWrite(r.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<S);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:P(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new g;u(a,n,!1,!1,"esriGeometryPolyline",1);const l=G(new g,a,o),c=G(new g,a,-o),h=f(c,"esriGeometryPolyline",!1,!1),m=f(l,"esriGeometryPolyline",!1,!1),d=v(m.paths,r.bounds.width),p=v(h.paths,r.bounds.width);this._current.offsetDirection="above";for(const u of d)y(u,i,t,!!s);this._current.offsetDirection="below";for(const u of p)y(u,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)y(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=I(t),c=this._current.shaping.bounds.width/(1<<S),h=Math.sqrt(n||D)/(1<<S),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?B:Math.log2(m/(h+c/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+S-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360,h={clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,h,!1);const m={clipAngle:c,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,m,!1),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:c,referenceBounds:h}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360,_=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),_){const d=Math.max(o,c[0],0),u=Math.min(B,c[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},b=t(this.evaluatedMeshParams.offsetX),M=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=m(b,-1*M),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=m(b,M),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,_),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+z}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+z}_placeFirst(e,s,n,a,l=!1){const{out:c,id:h,shaping:d,zoomRange:u,referenceBounds:f}=this._current,g=d.glyphs,p=t(this.evaluatedMeshParams.offsetX),_=t(this.evaluatedMeshParams.offsetY),b=m(p,_),x=i(r(),-e.angle);o(b,b,x);for(const t of g){const i=t.x>d.bounds.x?n:1-n,r=i*e.remainingLength+(1-i)*e.backwardLength,o=Math.abs(t.x+t.width/2-d.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(o/(r+z))),g=Math.max(s,l?0:m);if(t.maxZoom=Math.min(u[1],B),t.angle=e.angle+(1-n)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(n||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new M(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,s,n,a,l,c,h){const{out:d,id:u,shaping:f,referenceBounds:g}=this._current,p=f.glyphs,_=e.dx/e.length,b=e.dy/e.length,x={x:e.x+n*-l*_,y:e.y+n*-l*b},v=t(this.evaluatedMeshParams.offsetX),y=t(this.evaluatedMeshParams.offsetY),P=m(v,y),w=i(r(),-e.angle);o(P,P,w);for(const t of p){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const s=Math.abs(t.x+t.width/2-f.bounds.x),r=Math.max(0,this._zoomLevel+Math.log2(s/n)-.1),o=Math.max(a,this._zoomLevel+Math.log2(s/(n+e.length+z)));if(0!==r&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=o,t.maxZoom=r,this._writeLineGlyph(d,u,x.x,x.y,t,h,g,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new M(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);d.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,s,r,o,n,a){if(i<0||i>p||s<0||s>p)return;e.recordStart(this.instanceId,this.attributeLayout,r.textureBinding);const{texcoords:l,offsets:c}=r,{fontSize:h,haloSize:m,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:d,color:w(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],r.minZoom),maxZoom:Math.min(this._current.zoomRange[1],r.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*_)/_}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),s=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),s=this._packedZoom(s);const r=this._packedZoom(this._zoomLevel);return i<=r&&r<=s}}function G(e,t,i){const{coords:s,lengths:r}=t,o=d(),m=d(),u=d(),f=d(),g=d(),p=d(),_=2;let b=0;for(let d=0;d<r.length;d++){const t=r[d];for(let r=0;r<t;r++){const d=_*(r+b-1),M=_*(r+b),x=_*(r+b+1);r>0?n(o,s[d],s[d+1]):n(o,0,0),n(m,s[M],s[M+1]),r<t-1?n(u,s[x],s[x+1]):n(u,0,0),0===r?n(f,0,0):(a(f,m,o),l(f,f),n(f,f[1],-f[0])),r===t-1?n(g,0,0):(a(g,u,m),l(g,g),n(g,g[1],-g[0])),c(p,f,g),l(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&h(p,p,v),h(p,p,i),e.coords.push(m[0]+p[0],m[1]+p[1])}e.lengths.push(t),b+=t}return e}export{A as LabelMeshWriter};
5
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as n,sub as a,normalize as l,add as c,scale as h}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{GeometryCursor as u}from"../../../../../../../geometry/GeometryCursor.js";import{generalizeOptimizedGeometry as f,convertToGeometry as g}from"../../../../../../../layers/graphics/featureConversionUtils.js";import _ from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as p,minMaxZoomPrecisionFactor as b}from"../../../definitions.js";import x from"../../../collisions/BoundingBox.js";import{LabelMetric as M}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as P,processColorInput as w}from"../fill/meshWriterUtils.js";import{TextMeshWriter as L,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,A=128,D=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class I extends L{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,0,t);break}case"esriGeometryMultipoint":{let i=0;const s=u.fromFeatureSetReader(t);if(s?.nextPath())for(;s.nextPoint();)this._writePoint(e,s.x,s.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,s){const[r,o]=this._getMetricDir(),n=this.evaluatedMeshParams.scaleInfo?.maxScale??0,a=this.evaluatedMeshParams.scaleInfo?.minScale??0,l=this.evaluatedMeshParams.labelClassId;return new M(e,0,l,t,i,r,o,n,a,s)}_writePoint(e,t,i,s,r){if(t<0||t>p||i<0||i>p)return;const o=this._getShaping();if(!o)return;const n=r.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,[l,c]=this._getMetricDir(),h=this.evaluatedMeshParams.scaleInfo?.maxScale??0,m=this.evaluatedMeshParams.scaleInfo?.minScale??0,d=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new M(n,s,a,t,i,l,c,h,m,d)),this._writeGlyphs(e,n,t,i,o,0,d,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<S);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:P(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new _;f(a,n,!1,!1,"esriGeometryPolyline",1);const l=G(new _,a,o),c=G(new _,a,-o),h=g(c,"esriGeometryPolyline",!1,!1),m=g(l,"esriGeometryPolyline",!1,!1),d=v(m.paths,r.bounds.width),u=v(h.paths,r.bounds.width);this._current.offsetDirection="above";for(const f of d)y(f,i,t,!!s);this._current.offsetDirection="below";for(const f of u)y(f,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)y(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=D(t),c=this._current.shaping.bounds.width/(1<<S),h=Math.sqrt(n||A)/(1<<S),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?B:Math.log2(m/(h+c/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+S-u),g=this._zoomLevel-f,_=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,_)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360,h={clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,h,!1);const m={clipAngle:c,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,m,!1),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:c,referenceBounds:h}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,_=(e.angle*(180/Math.PI)+180)%360,p=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),p){const d=Math.max(o,c[0],0),u=Math.min(B,c[1]),f=i(r(),-e.angle),p={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},b=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=m(b,-1*x),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,p),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=m(b,x),[i,o]=l.shapeBackground(s(r(),f,t));p.clipAngle=_,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,p),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,_,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+z}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+z}_placeFirst(e,s,n,a,l=!1){const{out:c,id:h,shaping:d,zoomRange:u,referenceBounds:f}=this._current,g=d.glyphs,_=t(this.evaluatedMeshParams.offsetX),p=t(this.evaluatedMeshParams.offsetY),b=m(_,p),M=i(r(),-e.angle);o(b,b,M);for(const t of g){const i=t.x>d.bounds.x?n:1-n,r=i*e.remainingLength+(1-i)*e.backwardLength,o=Math.abs(t.x+t.width/2-d.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(o/(r+z))),g=Math.max(s,l?0:m);if(t.maxZoom=Math.min(u[1],B),t.angle=e.angle+(1-n)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(n||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new x(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,s,n,a,l,c,h){const{out:d,id:u,shaping:f,referenceBounds:g}=this._current,_=f.glyphs,p=e.dx/e.length,b=e.dy/e.length,M={x:e.x+n*-l*p,y:e.y+n*-l*b},v=t(this.evaluatedMeshParams.offsetX),y=t(this.evaluatedMeshParams.offsetY),P=m(v,y),w=i(r(),-e.angle);o(P,P,w);for(const t of _){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const s=Math.abs(t.x+t.width/2-f.bounds.x),r=Math.max(0,this._zoomLevel+Math.log2(s/n)-.1),o=Math.max(a,this._zoomLevel+Math.log2(s/(n+e.length+z)));if(0!==r&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=o,t.maxZoom=r,this._writeLineGlyph(d,u,M.x,M.y,t,h,g,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new x(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);d.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,s,r,o,n,a){if(i<0||i>p||s<0||s>p)return;e.recordStart(this.instanceId,this.attributeLayout,r.textureBinding);const{texcoords:l,offsets:c}=r,{fontSize:h,haloSize:m,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:d,color:w(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],r.minZoom),maxZoom:Math.min(this._current.zoomRange[1],r.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*b)/b}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),s=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),s=this._packedZoom(s);const r=this._packedZoom(this._zoomLevel);return i<=r&&r<=s}}function G(e,t,i){const{coords:s,lengths:r}=t,o=d(),m=d(),u=d(),f=d(),g=d(),_=d(),p=2;let b=0;for(let d=0;d<r.length;d++){const t=r[d];for(let r=0;r<t;r++){const d=p*(r+b-1),x=p*(r+b),M=p*(r+b+1);r>0?n(o,s[d],s[d+1]):n(o,0,0),n(m,s[x],s[x+1]),r<t-1?n(u,s[M],s[M+1]):n(u,0,0),0===r?n(f,0,0):(a(f,m,o),l(f,f),n(f,f[1],-f[0])),r===t-1?n(g,0,0):(a(g,u,m),l(g,g),n(g,g[1],-g[0])),c(_,f,g),l(_,_);const v=_[0]*g[0]+_[1]*g[1];0!==v&&h(_,_,v),h(_,_,i),e.coords.push(m[0]+_[0],m[1]+_[1])}e.lengths.push(t),b+=t}return e}export{I as LabelMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Color.js";import r from"../../../Graphic.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as s,initial as l}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../layers/GraphicsLayer.js";import h from"../../../layers/support/TelemetryDisplay.js";import m from"../../../symbols/SimpleFillSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import c from"../engine/webgl/OverlayContainer.js";import f from"../engine/webgl/OverlayMultipoint.js";import{LayerView2DMixin as d}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import u from"./graphics/GraphicsView2D.js";import b from"../../layers/LayerView.js";const v=new i([255,127,0]);let _=class extends(d(b)){constructor(){super(...arguments),this._graphicsLayer=new n,this._frameOutlineGraphic=new r({symbol:new m({outline:{type:"simple-line",color:v}})}),this._sensorTrailGraphic=new r({symbol:new y({color:v})}),this._lineOfSightGraphic=new r({symbol:new y({color:v})}),this._sensorLocationGraphic=new r({symbol:new p({color:v})}),this._frameCenterGraphic=new r({symbol:new p({color:v,style:"cross"})}),this._overlayContainer=null,this.layer=null,this.symbolColor=v,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=t(this._graphicsLayer)}initialize(){this.addHandles(s((()=>this.symbolColor),(()=>{this._frameOutlineGraphic.symbol.outline.color=this.symbolColor,this._sensorTrailGraphic.symbol.color=this.symbolColor,this._lineOfSightGraphic.symbol.color=this.symbolColor,this._sensorLocationGraphic.symbol.color=this.symbolColor,this._frameCenterGraphic.symbol.color=this.symbolColor}),l)),this._graphicsLayer.graphics.addMany([this._frameOutlineGraphic,this._sensorTrailGraphic,this._lineOfSightGraphic,this._sensorLocationGraphic,this._frameCenterGraphic]),this.visibleTelemetryElements=new h({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0})}attach(){this._overlayContainer=new c,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new u({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new g(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on("graphic-update",this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([s((()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight]),(()=>this._updateVisibleTelemetryElements()),l),s((()=>[this.layer.telemetry,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight]),(()=>this._updateGraphicGeometries()),l)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=t(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail)}_updateGraphicGeometries(){const{telemetry:e}=this.layer,{visibleTelemetryElements:i}=this;e&&i&&(i.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,i.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,i.lineOfSight&&e.lineOfSight?this._lineOfSightGraphic.geometry=this.layer.telemetry.lineOfSight:this._lineOfSightGraphic.geometry=null,i.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,i.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;const e=new f(this.layer.videoElement);this.addAttachHandles([s((()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints]),(()=>{const{visibleTelemetryElements:i}=this;i?.frame?(e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=1):e.opacity=0}),l)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([a()],_.prototype,"graphicsView",void 0),e([a()],_.prototype,"layer",void 0),e([a()],_.prototype,"symbolColor",void 0),e([a({type:h})],_.prototype,"visibleTelemetryElements",void 0),_=e([o("esri.views.2d.layers.VideoLayerView2D")],_);const C=_;export{C as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../Color.js";import r from"../../../Graphic.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as s,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../layers/GraphicsLayer.js";import h from"../../../layers/support/TelemetryDisplay.js";import m from"../../../symbols/SimpleFillSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as c}from"../../../symbols/support/typeUtils.js";import f from"../engine/webgl/OverlayContainer.js";import d from"../engine/webgl/OverlayMultipoint.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import b from"./graphics/GraphicContainer.js";import u from"./graphics/GraphicsView2D.js";import _ from"../../layers/LayerView.js";const v=new i([255,127,0]);let C=class extends(g(_)){constructor(){super(...arguments),this._graphicsLayer=new n,this._frameOutlineGraphic=new r({symbol:new m({outline:{type:"simple-line",color:v}})}),this._sensorTrailGraphic=new r({symbol:new y({color:v})}),this._lineOfSightGraphic=new r({symbol:new y({color:v})}),this._sensorLocationGraphic=new r({symbol:new p({color:v})}),this._frameCenterGraphic=new r({symbol:new p({color:v,style:"cross"})}),this._overlayContainer=null,this.layer=null,this.sensorLocationSymbol=null,this.symbolColor=null,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=t(this._graphicsLayer)}initialize(){this.addHandles(s((()=>this.symbolColor),(()=>{this._frameOutlineGraphic.symbol.outline.color=this.symbolColor,this._sensorTrailGraphic.symbol.color=this.symbolColor,this._lineOfSightGraphic.symbol.color=this.symbolColor,this._sensorLocationGraphic.symbol.color=this.symbolColor,this._frameCenterGraphic.symbol.color=this.symbolColor}),l)),this._graphicsLayer.graphics.addMany([this._frameOutlineGraphic,this._sensorTrailGraphic,this._lineOfSightGraphic,this._sensorLocationGraphic,this._frameCenterGraphic]),this.visibleTelemetryElements=new h({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0}),this.symbolColor=this.layer?.telemetryColor??v;const e=this.layer?.sensorSymbol.type;switch(e){case"simple-marker":this._sensorLocationGraphic.symbol=this.layer?.sensorSymbol;break;case"picture-marker":case"cim":this._sensorLocationGraphic.symbol=this.layer.sensorSymbol;break;default:return}}attach(){this._overlayContainer=new f,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new u({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new b(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on("graphic-update",this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([s((()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight]),(()=>this._updateVisibleTelemetryElements()),l),s((()=>[this.layer.telemetry,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight]),(()=>this._updateGraphicGeometries()),l)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=t(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail)}_updateGraphicGeometries(){const{telemetry:e}=this.layer,{visibleTelemetryElements:i}=this;e&&i&&(i.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,i.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,i.lineOfSight&&e.lineOfSight?this._lineOfSightGraphic.geometry=this.layer.telemetry.lineOfSight:this._lineOfSightGraphic.geometry=null,i.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,i.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;const e=new d(this.layer.videoElement);this.addAttachHandles([s((()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints]),(()=>{const{visibleTelemetryElements:i}=this;i?.frame?(e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=1):e.opacity=0}),l)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([o()],C.prototype,"graphicsView",void 0),e([o()],C.prototype,"layer",void 0),e([o({types:c})],C.prototype,"sensorLocationSymbol",void 0),e([o()],C.prototype,"symbolColor",void 0),e([o({type:h})],C.prototype,"visibleTelemetryElements",void 0),C=e([a("esri.views.2d.layers.VideoLayerView2D")],C);const w=C;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as p,convertToGeometry as f,convertFromNestedArray as g}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as k,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as F}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as j}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as T}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as L}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as G}from"../support/FeatureSetReaderJSON.js";let C;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),z=32;class M{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class W{static getOid(t){return k+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new M(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const r=new Set(this._nextObservationRecords.map((t=>t.objectId))),i=this._observationRecords.filter((t=>!r.has(t.objectId))).map((t=>t.objectId));let a,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":a=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":a=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":a=this._isStream?v:null}o=this._isStream?e?.end??Date.now():e?.end??-1/0;const n=t.map((t=>t.reader.getCursor()));let l;for(let c=this._nextObservationRecords.length-1;c>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);c--){const t=this._nextObservationRecords[c],e=n[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=a?e.readAttributeAsTimestamp(a):null;(null!=r?o-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),l??=t)}if(null!=l){const{chunkIndex:t,featureIndex:e,objectId:r,displayId:i}=l,a=n[t];s(a),a.setIndex(e);const o=new _(a.readGeometryWorldSpace(),{...a.readAttributes(),[y]:I.LatestObservation},null,r,i);this._latestObservationFeature=o}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=Z(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=j.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,z))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new b;p(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);X(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,F,F)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new b;p(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends x{constructor(t){super(t),this.done=!1}}class q extends T{static async create(t,e,s,a,o,n){const l=new w({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>O.create(l,t)))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{C={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=L.createFeature({geometryType:"esriGeometryPolyline",objectIdField:"aggregateId",fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return this._source.chunks().some((t=>!this._handledChunks.has(t.chunkId)))}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new U(t)}async*applyOverrideUpdate(t){P().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null==t)for(const e of a.observations()){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId)}}else{const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId)}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature());for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=W.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new W(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=G.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=G.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=A.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return g(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=m({paths:[e],spatialReference:s});if(null!=r)return g(t,r.paths,!1,!1)}return g(t,[e],!1,!1)}const r=C.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=C.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=C.toGeometry(e,i);if(null!=s&&"paths"in s)return g(t,s.paths,!1,!1)}}return g(t,[e],!1,!1)}function X(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function Z(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
5
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as m}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as p,convertToGeometry as f,convertFromNestedArray as g}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,TrackPart as I,externalTrackLineOidPrefix as k,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as F}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as j}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as T}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as L}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as C}from"../support/FeatureSetReaderJSON.js";let G;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),z=32;class M{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class W{static getOid(t){return k+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes??{},aggregateId:this.objectId,[y]:I.TrackLine};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}stageObservation(t,e){this._nextObservationRecords.push(new M(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e){const r=new Set(this._nextObservationRecords.map((t=>t.objectId))),i=this._observationRecords.filter((t=>!r.has(t.objectId))).map((t=>t.objectId));let a,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort(((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0})),this._schema.timeField){case"startTimeField":a=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":a=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":a=this._isStream?v:null}o=this._isStream?e?.end??Date.now():e?.end??-1/0;const n=t.map((t=>t.reader.getCursor()));let l;for(let c=this._nextObservationRecords.length-1;c>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);c--){const t=this._nextObservationRecords[c],e=n[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=a?e.readAttributeAsTimestamp(a):null;(null!=r?o-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),l??=t)}if(null!=l){const{chunkIndex:t,featureIndex:e,objectId:r,displayId:i}=l,a=n[t];s(a),a.setIndex(e);const o=new _(a.readGeometryWorldSpace(),{...a.readAttributes(),[y]:I.LatestObservation},null,r,i);this._latestObservationFeature=o}else this._latestObservationFeature=null;return this._trackLineGeometry=E(this._trackLineGeometry,this._trackLinePath,this._spatialReference),this._bounds=Z(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=j.create(this._fields);const r=t.map((t=>t.reader.getCursor()));for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,z))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=new b;p(a,r,!1,!1,this._metadata.geometryType,t.subscription.tile.transform);const o=l(1/0,1/0,-1/0,-1/0);X(a,((t,e)=>u(o,[t,e])));if(!c(o,l(0,0,F,F)))return null;return new _(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=new b;p(e,this._trackLineGeometry,!1,!1,"esriGeometryPolyline",t.subscription.tile.transform);return new _(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new _(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class U extends x{constructor(t){super(t),this.done=!1}}class q extends T{static async create(t,e,s,a,o,n){const l=new w({spatialReference:e}),c=await Promise.all(t.fields.map((async t=>O.create(l,t)))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then((([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}})),new q(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=L.createFeature({geometryType:"esriGeometryPolyline",objectIdField:"aggregateId",fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map((t=>t.chunkId)));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new U(t)}async*applyOverrideUpdate(t){P().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null==t)for(const e of a.observations()){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId)}}else{const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId)}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map((t=>t.reader.getCursor()));for(const a of this._tracks.values()){e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature());for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,attributes:{},...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),(t=>t.objectId));return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=W.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new W(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=C.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=C.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map((()=>[]));for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map(((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=A.from(i,s[r]);return a.setProcessorAttributes({[y]:I.PreviousObservation}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a})).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function E(t,e,s){if(e.length<2)return g(t,[e],!1,!1);if(s.isWrappable){let r=!1;for(let t=1;t<e.length;t++){const i=e[t][0],a=h(i,e[t-1][0],s);i!==a&&(e[t][0]=a,r=!0)}if(r){const r=m({paths:[e],spatialReference:s});if(null!=r)return g(t,r.paths,!1,!1)}return g(t,[e],!1,!1)}const r=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),i=G.fromSpatialReference(s);if(null!=i){const e=a(r,1e6,i,o.geodesic);if(null!=e){const s=G.toGeometry(e,i);if(null!=s&&"paths"in s)return g(t,s.paths,!1,!1)}}return g(t,[e],!1,!1)}function X(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function Z(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{q as TrackStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as r,parameter as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends r{constructor(){super(...arguments),this.reduced=!1}}e([o()],s.prototype,"reduced",void 0);export{s as ChapmanAtmosphereTechniqueConfiguration};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as r,parameter as s}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{ToneMappingFunction as o}from"../webgl-engine/shaders/ToneMapping.glsl.js";class i extends r{constructor(){super(...arguments),this.reduced=!1,this.toneMapping=o.ACES}}e([s()],i.prototype,"reduced",void 0);export{i as ChapmanAtmosphereTechniqueConfiguration};
@@ -2,11 +2,11 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRenderingWater as t}from"./PhysicallyBasedRendering.glsl.js";import{distanceFadeStart as r,distanceFadeEnd as i}from"./ScreenSpaceConstants.js";import{ScreenSpaceReflections as n}from"./ScreenSpaceReflections.glsl.js";import{CloudsParallaxShading as a}from"../util/CloudsParallaxShading.glsl.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{glsl as d}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as s}from"../../shaderModules/Texture2DBindUniform.js";import{ToneMapping as f}from"../../../shaders/ToneMapping.glsl.js";function m(m,v){m.include(t,v),m.include(o),m.include(e),v.cloudReflections&&m.include(a),m.include(n,v);const u=m.fragment;u.include(f),u.constants.add("fresnelSky","vec3",[.02,1,15]),u.constants.add("fresnelMaterial","vec2",[.02,.1]),u.constants.add("roughness","float",.015),u.constants.add("foamIntensityExternal","float",1.7),u.constants.add("ssrIntensity","float",.65),u.constants.add("ssrHeightFadeStart","float",r),u.constants.add("ssrHeightFadeEnd","float",i),u.constants.add("waterDiffusion","float",.92),u.constants.add("waterSeaColorMod","float",.8),u.constants.add("correctionViewingPowerFactor","float",.4),u.constants.add("skyZenitColor","vec3",[.52,.68,.9]),u.constants.add("skyColor","vec3",[.67,.79,.9]),u.constants.add("cloudFresnelModifier","vec2",[1.2,.01]),u.code.add(d`PBRShadingWater shadingInfo;
5
+ import{FoamColor as e}from"./FoamRendering.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PhysicallyBasedRenderingWater as t}from"./PhysicallyBasedRendering.glsl.js";import{distanceFadeStart as r,distanceFadeEnd as i}from"./ScreenSpaceConstants.js";import{ScreenSpaceReflections as n}from"./ScreenSpaceReflections.glsl.js";import{CloudsParallaxShading as a}from"../util/CloudsParallaxShading.glsl.js";import{FloatBindUniform as l}from"../../shaderModules/FloatBindUniform.js";import{glsl as d}from"../../shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../../shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as s}from"../../shaderModules/Texture2DBindUniform.js";import{ToneMapping as f,ToneMappingFunction as m}from"../../../shaders/ToneMapping.glsl.js";function v(v,u){v.include(t,u),v.include(o),v.include(e),u.cloudReflections&&v.include(a),v.include(n,u);const p=v.fragment;p.include(f,{toneMapping:m.ACES}),p.constants.add("fresnelSky","vec3",[.02,1,15]),p.constants.add("fresnelMaterial","vec2",[.02,.1]),p.constants.add("roughness","float",.015),p.constants.add("foamIntensityExternal","float",1.7),p.constants.add("ssrIntensity","float",.65),p.constants.add("ssrHeightFadeStart","float",r),p.constants.add("ssrHeightFadeEnd","float",i),p.constants.add("waterDiffusion","float",.92),p.constants.add("waterSeaColorMod","float",.8),p.constants.add("correctionViewingPowerFactor","float",.4),p.constants.add("skyZenitColor","vec3",[.52,.68,.9]),p.constants.add("skyColor","vec3",[.67,.79,.9]),p.constants.add("cloudFresnelModifier","vec2",[1.2,.01]),p.code.add(d`PBRShadingWater shadingInfo;
6
6
  vec3 getSkyGradientColor(in float cosTheta, in vec3 horizon, in vec3 zenit) {
7
7
  float exponent = pow((1.0 - cosTheta), fresnelSky[2]);
8
8
  return mix(zenit, horizon, exponent);
9
- }`),u.uniforms.add(new l("lightingSpecularStrength",(e=>e.lighting.mainLight.specularStrength)),new l("lightingEnvironmentStrength",(e=>e.lighting.mainLight.environmentStrength))),u.code.add(d`vec3 getSeaColor(in vec3 n, in vec3 v, in vec3 l, vec3 color, in vec3 lightIntensity, in vec3 localUp, in float shadow, float foamIntensity, vec3 viewPosition, vec3 position) {
9
+ }`),p.uniforms.add(new l("lightingSpecularStrength",(e=>e.lighting.mainLight.specularStrength)),new l("lightingEnvironmentStrength",(e=>e.lighting.mainLight.environmentStrength))),p.code.add(d`vec3 getSeaColor(in vec3 n, in vec3 v, in vec3 l, vec3 color, in vec3 lightIntensity, in vec3 localUp, in float shadow, float foamIntensity, vec3 viewPosition, vec3 position) {
10
10
  float reflectionHit = 0.0;
11
11
  float reflectionHitDiffused = 0.0;
12
12
  vec3 seaWaterColor = linearizeGamma(color);
@@ -40,10 +40,10 @@ foam = foamIntensity2FoamColor(foamIntensityExternal, foamIntensity, skyZenitCol
40
40
  }
41
41
  float correctionViewingFactor = pow(max(dot(v, localUp), 0.0), correctionViewingPowerFactor);
42
42
  vec3 normalCorrectedClouds = mix(localUp, n, correctionViewingFactor);
43
- vec3 reflectedWorld = normalize(reflect(-v, normalCorrectedClouds));`),v.cloudReflections&&u.uniforms.add(new l("cloudsOpacity",(e=>e.clouds.opacity))).code.add(d`vec4 cloudsColor = renderClouds(reflectedWorld, position);
43
+ vec3 reflectedWorld = normalize(reflect(-v, normalCorrectedClouds));`),u.cloudReflections&&p.uniforms.add(new l("cloudsOpacity",(e=>e.clouds.opacity))).code.add(d`vec4 cloudsColor = renderClouds(reflectedWorld, position);
44
44
  cloudsColor.a = 1.0 - cloudsColor.a;
45
45
  cloudsColor = pow(cloudsColor, vec4(GAMMA));
46
- cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * cloudsOpacity;`),v.screenSpaceReflections?u.uniforms.add(new c("view",(e=>e.camera.viewMatrix)),new s("lastFrameColorTexture",(e=>e.ssr.lastFrameColor?.getTexture())),new l("fadeFactorSSR",(e=>e.ssr.fadeFactor))).code.add(d`vec3 viewDir = normalize(viewPosition);
46
+ cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * cloudsOpacity;`),u.screenSpaceReflections?p.uniforms.add(new c("view",(e=>e.camera.viewMatrix)),new s("lastFrameColorTexture",(e=>e.ssr.lastFrameColor?.getTexture())),new l("fadeFactorSSR",(e=>e.ssr.fadeFactor))).code.add(d`vec3 viewDir = normalize(viewPosition);
47
47
  vec4 viewNormalVectorCoordinate = view * vec4(n, 0.0);
48
48
  vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz);
49
49
  vec4 viewUp = view * vec4(localUp, 0.0);
@@ -63,7 +63,7 @@ reflectionHitDiffused * fresnelModifier.y * ssrIntensity;
63
63
  }
64
64
  float seaColorMod = mix(waterSeaColorMod, waterSeaColorMod * 0.5, reflectionHitDiffused);
65
65
  vec3 waterRenderedColor = tonemapACES((1.0 - reflectionHitDiffused) * reflSky + reflectedColor +
66
- reflSea * seaColorMod + specular + foam);`):u.code.add(d`vec3 waterRenderedColor = tonemapACES(reflSky + reflSea * waterSeaColorMod + specular + foam);`),v.cloudReflections?v.screenSpaceReflections?u.code.add(d`return waterRenderedColor * (1.0 - (1.0 - reflectionHit) * cloudsColor.a) + (1.0 - reflectionHit) * cloudsColor.xyz;
67
- }`):u.code.add(d`return waterRenderedColor * (1.0 - cloudsColor.a) + cloudsColor.xyz;
68
- }`):u.code.add(d`return waterRenderedColor;
69
- }`)}export{m as Water};
66
+ reflSea * seaColorMod + specular + foam);`):p.code.add(d`vec3 waterRenderedColor = tonemapACES(reflSky + reflSea * waterSeaColorMod + specular + foam);`),u.cloudReflections?u.screenSpaceReflections?p.code.add(d`return waterRenderedColor * (1.0 - (1.0 - reflectionHit) * cloudsColor.a) + (1.0 - reflectionHit) * cloudsColor.xyz;
67
+ }`):p.code.add(d`return waterRenderedColor * (1.0 - cloudsColor.a) + cloudsColor.xyz;
68
+ }`):p.code.add(d`return waterRenderedColor;
69
+ }`)}export{v as Water};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{B as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
5
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/output/ReadDepth.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"./BloomPresets.glsl.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{B as BloomCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/BloomComposition.glsl.js";
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../../../../../chunks/tslib.es6.js";import{parameter as e,ShaderTechniqueConfiguration as s}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{ToneMappingFunction as r}from"../../shaders/ToneMapping.glsl.js";class t extends s{constructor(){super(...arguments),this.toneMapping=r.ACES}}o([e({count:r.COUNT})],t.prototype,"toneMapping",void 0);export{t as BloomCompositionTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as l}from"../../../webgl/formats.js";import{TransparentEnvironment as m}from"../TransparentEnvironment.js";import{B as n,a as u}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as c}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as p}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as b}from"./BloomCompositionTechnique.js";import{blurRadiusPresets as _,lodFactorsPresets as d,normalizePreset as f}from"./BloomPresets.glsl.js";import{RenderRequestType as g}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as P,DepthStencilAttachment as T,FramebufferBit as R}from"../../../../webgl/enums.js";let j=class extends m{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionParameters=new p,this._blurParameters=new n,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=_[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(_.cloudy,_[e.type],r)}this._compositionParameters.lodFactors=d[e.type].far,this._compositionParameters.lodFactorsFront=d[e.type].near,this.requestRender(g.UPDATE)}precompile(){this._blurHorizontalConfiguration.bloomStage=u.Horizontal,this._blurVerticalConfiguration.bloomStage=u.Vertical,this.techniques.precompile(c,this._blurHorizontalConfiguration),this.techniques.precompile(c,this._blurVerticalConfiguration),this.techniques.precompile(b)}render(e){const t=e.find((({name:e})=>e===a.TRANSPARENT_ENVIRONMENT)),r=t.getAttachment(P)?.attachment;if(!r)return t;const o=this.techniques.get(c,this._blurHorizontalConfiguration),s=this.techniques.get(c,this._blurVerticalConfiguration),i=this.techniques.get(b);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(g.UPDATE),t;const m=t.getTexture(),n=this.fboCache,{fullWidth:u,fullHeight:h}=this.bindParameters.camera,p=this.renderingContext;let _=r,d=u,f=h;const R=5,j=this._blurParameters.blurRadius;for(let a=0;a<R;a++){const e=n.acquire(d,f,"bloomHorizontal",l.RGBA16F);this._blurParameters.color=_,this._prepareFBO(e,d,f),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=n.acquire(d,f,"bloomVertical",l.RGBA16F);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,d,f),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,d=Math.ceil(d/2),f=Math.ceil(f/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=j,this._compositionParameters.color=m,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const q=this.acquireOutputFramebuffer();return this._prepareFBO(q,u,h),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),q.attachDepth(t.getAttachment(T)),q.attachColor(t.getAttachment(P),P),q}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(R.COLOR)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=f(e)}}}};e([s()],j.prototype,"consumes",void 0),j=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],j);export{j as BloomRenderNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as r,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as m}from"../../../webgl/formats.js";import{TransparentEnvironment as n}from"../TransparentEnvironment.js";import{B as l,a as u}from"../../../../../chunks/BloomBlur.glsl.js";import{BloomBlurTechnique as c}from"./BloomBlurTechnique.js";import{BloomBlurTechniqueConfiguration as h}from"./BloomBlurTechniqueConfiguration.js";import{B as p}from"../../../../../chunks/BloomComposition.glsl.js";import{BloomCompositionTechnique as b}from"./BloomCompositionTechnique.js";import{BloomCompositionTechniqueConfiguration as _}from"./BloomCompositionTechniqueConfiguration.js";import{blurRadiusPresets as f,lodFactorsPresets as d,normalizePreset as g}from"./BloomPresets.glsl.js";import{RenderRequestType as P}from"../../lib/basicInterfaces.js";import{ColorAttachment1 as T,DepthStencilAttachment as R,FramebufferBit as C}from"../../../../webgl/enums.js";let j=class extends n{constructor(e){super(e),this.consumes={required:[a.TRANSPARENT_ENVIRONMENT,"emissive"]},this._blurHorizontalConfiguration=new h,this._blurVerticalConfiguration=new h,this._compositionConfiguration=new _,this._compositionParameters=new p,this._blurParameters=new l,this._blurScale=3.06,this._bloomResults=new Array}initialize(){this.addHandles([r((()=>this._updateFogParameters()),(()=>{}),o),r((()=>this.view.qualitySettings.bloom),(e=>{e?(this._enable(),this.precompile()):this._disable()}),o)])}destroy(){}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=f[e.type];else{const r="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(f.cloudy,f[e.type],r)}this._compositionParameters.lodFactors=d[e.type].far,this._compositionParameters.lodFactorsFront=d[e.type].near,this.requestRender(P.UPDATE)}precompile(){this.techniques.precompile(c,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.bloomStage=u.Vertical,this.techniques.precompile(c,this._blurVerticalConfiguration),this.techniques.precompile(b,this._compositionConfiguration)}render(e){const t=e.find((({name:e})=>e===a.TRANSPARENT_ENVIRONMENT)),r=t.getAttachment(T)?.attachment;if(!r)return t;const o=this.techniques.get(c,this._blurHorizontalConfiguration),s=this.techniques.get(c,this._blurVerticalConfiguration),i=this.techniques.get(b,this._compositionConfiguration);if(!o.compiled||!s.compiled||!i.compiled)return this.requestRender(P.UPDATE),t;const n=t.getTexture(),l=this.fboCache,{fullWidth:u,fullHeight:h}=this.bindParameters.camera,p=this.renderingContext;let _=r,f=u,d=h;const g=5,C=this._blurParameters.blurRadius;for(let a=0;a<g;a++){const e=l.acquire(f,d,"bloomHorizontal",m.RGBA16F);this._blurParameters.color=_,this._prepareFBO(e,f,d),p.bindTechnique(o,this.bindParameters,this._blurParameters),p.screen.draw();const t=l.acquire(f,d,"bloomVertical",m.RGBA16F);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,f,d),p.bindTechnique(s,this.bindParameters,this._blurParameters),p.screen.draw(),e.release(),this._bloomResults[a]=t,f=Math.ceil(f/2),d=Math.ceil(d/2),_=this._bloomResults[a].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=n,this._compositionParameters.bloomTexture0=this._bloomResults[0].getTexture(),this._compositionParameters.bloomTexture1=this._bloomResults[1].getTexture(),this._compositionParameters.bloomTexture2=this._bloomResults[2].getTexture(),this._compositionParameters.bloomTexture3=this._bloomResults[3].getTexture(),this._compositionParameters.bloomTexture4=this._bloomResults[4].getTexture();const j=this.acquireOutputFramebuffer();return this._prepareFBO(j,u,h),p.bindTechnique(i,this.bindParameters,this._compositionParameters),p.screen.draw(),this._bloomResults.forEach((e=>e.release())),j.attachDepth(t.getAttachment(R)),j.attachColor(t.getAttachment(T),T),j}_prepareFBO(e,t,r){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,r),o.setClearColor(0,0,0,0),o.clear(C.COLOR)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setLodFactors:e=>{this._compositionParameters.lodFactors=g(e)}}}};e([s()],j.prototype,"consumes",void 0),j=e([i("esri.views.3d.webgl-engine.effects.bloom.BloomRenderNode")],j);export{j as BloomRenderNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as r,parameter as o}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class s extends r{constructor(){super(...arguments),this.reduced=!1}}e([o()],s.prototype,"reduced",void 0);export{s as HazeTechniqueConfiguration};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{ShaderTechniqueConfiguration as r,parameter as s}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{ToneMappingFunction as o}from"../../shaders/ToneMapping.glsl.js";class t extends r{constructor(){super(...arguments),this.reduced=!1,this.toneMapping=o.ACES}}e([s()],t.prototype,"reduced",void 0);export{t as HazeTechniqueConfiguration};