@arcgis/core 5.1.0-next.73 → 5.1.0-next.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Viewpoint.js +1 -1
- package/applications/Urban/editingSessionUtils.d.ts +95 -0
- package/applications/Urban/editingSessionUtils.js +2 -0
- package/arcade/ArcadePortal.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/functions/aiServices.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade/portalUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d17fcfc502f0e0fa6523.js → 003476e950bd27a2f884.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a664451845a47048859.js → 0539b5d015157c1d34a0.js} +1 -1
- package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +2 -0
- package/assets/esri/core/workers/chunks/{5a4d7ba6dc1d4b41d80d.js → 07eff82916681fcff069.js} +1 -1
- package/assets/esri/core/workers/chunks/09630888267cde87654f.js +1 -0
- package/assets/esri/core/workers/chunks/{8a14e3db28c403b046cf.js → 0d2bc1be5802681666a4.js} +1 -1
- package/assets/esri/core/workers/chunks/0eed2b1b06355ab89013.js +1 -0
- package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +1 -0
- package/assets/esri/core/workers/chunks/146424b5717d0a645ee1.js +1 -0
- package/assets/esri/core/workers/chunks/{cfe246adb5e6cb6f0cfc.js → 14eb2cc8e2ad6d8d03fd.js} +1 -1
- package/assets/esri/core/workers/chunks/1765dfeac20e34ce25b7.js +1 -0
- package/assets/esri/core/workers/chunks/176dd195f77b98cb0b0f.js +1 -0
- package/assets/esri/core/workers/chunks/18f77ee3552d92962f15.js +1 -0
- package/assets/esri/core/workers/chunks/1906416c84bab369bbd6.js +1 -0
- package/assets/esri/core/workers/chunks/1a87e9bbd85ba29b1514.js +1 -0
- package/assets/esri/core/workers/chunks/{b98c24229463029504e8.js → 1f6b7626f333809837ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{b54b7cc6b23a70fed700.js → 1f8ccf96069ac3a40c3d.js} +1 -1
- package/assets/esri/core/workers/chunks/1ff3c15a51c4dc991806.js +1 -0
- package/assets/esri/core/workers/chunks/{cdf6ad970dc1893dac58.js → 24646a1176ce34039155.js} +1 -1
- package/assets/esri/core/workers/chunks/2a2e97918524e0f436d7.js +1 -0
- package/assets/esri/core/workers/chunks/2b0b398180ed98c2c84c.js +1 -0
- package/assets/esri/core/workers/chunks/{03894992558d063d0d5e.js → 312036c89a6a09bb06c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{80ace1c7203c5059525d.js → 330b47ac0759c3c35cc5.js} +1 -1
- package/assets/esri/core/workers/chunks/34b6b5dd415c68f0b0d1.js +1 -0
- package/assets/esri/core/workers/chunks/{422824e407b550170c8c.js → 34ea3ed78041437a8fc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 359d3acb3953e64e5a78.js} +1 -1
- package/assets/esri/core/workers/chunks/384c235d36f32769e32b.js +1 -0
- package/assets/esri/core/workers/chunks/3a183259805638c25363.js +1 -0
- package/assets/esri/core/workers/chunks/{0839da55707f7c4cf780.js → 3b9100c59a8050f4834e.js} +1 -1
- package/assets/esri/core/workers/chunks/{deaca3cd202851ecf9c2.js → 3cce9dad8ee0e4971d50.js} +1 -1
- package/assets/esri/core/workers/chunks/3efbb684c0409955186d.js +1 -0
- package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +1 -0
- package/assets/esri/core/workers/chunks/42336e0d1ef88737b078.js +1 -0
- package/assets/esri/core/workers/chunks/452c01cecbbd1e370098.js +1 -0
- package/assets/esri/core/workers/chunks/47656ec12401e53f4bd3.js +1 -0
- package/assets/esri/core/workers/chunks/47b3a5213539548ff3a6.js +1 -0
- package/assets/esri/core/workers/chunks/{260d4571722cb1ff1366.js → 484d6c1b0fe1633515b7.js} +1 -1
- package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +1 -0
- package/assets/esri/core/workers/chunks/4c97cc922eece3a91b6b.js +1 -0
- package/assets/esri/core/workers/chunks/52b3a11c962810bc6dbe.js +1 -0
- package/assets/esri/core/workers/chunks/53750e85f3128993a43a.js +1 -0
- package/assets/esri/core/workers/chunks/{f207b3be0714cc50030a.js → 537fe2522dff1e6ce03b.js} +1 -1
- package/assets/esri/core/workers/chunks/{656d6963e8f837fbf28f.js → 54023458195549f66215.js} +1 -1
- package/assets/esri/core/workers/chunks/55fd201ca5e10c6e4761.js +1 -0
- package/assets/esri/core/workers/chunks/56941e8bbd2d49bf2656.js +1 -0
- package/assets/esri/core/workers/chunks/{faad127dc07e54e7f6d1.js → 5abe34bb0110694f7b42.js} +1 -1
- package/assets/esri/core/workers/chunks/5d8e944b192aad4cf986.js +1 -0
- package/assets/esri/core/workers/chunks/{a78bc340a794fd332667.js → 5e1b847b116d21908a54.js} +1 -1
- package/assets/esri/core/workers/chunks/5ed8d8b5336c81fbcda3.js +1 -0
- package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +1 -0
- package/assets/esri/core/workers/chunks/6124141ac642e4ce1454.js +1 -0
- package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +1 -0
- package/assets/esri/core/workers/chunks/65c61171e6c6be5c5c2f.js +1 -0
- package/assets/esri/core/workers/chunks/6a3d207308b29651f397.js +1 -0
- package/assets/esri/core/workers/chunks/{b6cadb8a579241adcb86.js → 6b66fc32451433129a88.js} +1 -1
- package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +1 -0
- package/assets/esri/core/workers/chunks/6f7aaba26773fe416ac2.js +1 -0
- package/assets/esri/core/workers/chunks/702e8468836863abd81b.js +1 -0
- package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +1 -0
- package/assets/esri/core/workers/chunks/{9f4b97204def91567e3c.js → 7595ceba529ed01c7590.js} +1 -1
- package/assets/esri/core/workers/chunks/75d5ea0da181f9e7425f.js +1312 -0
- package/assets/esri/core/workers/chunks/{af75e91b88e747aa76ac.js → 7601278ebced0c0c31cf.js} +1 -1
- package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +1 -0
- package/assets/esri/core/workers/chunks/{1661684357912726a72a.js → 77dd719516138afb1a2a.js} +1 -1
- package/assets/esri/core/workers/chunks/7b6c8be59ed87e386aa4.js +1 -0
- package/assets/esri/core/workers/chunks/7c820c5f6f05480d5050.js +1 -0
- package/assets/esri/core/workers/chunks/{ce2aa75e084ee56f5e29.js → 7f55eef696e9ed717bfc.js} +1 -1
- package/assets/esri/core/workers/chunks/80f4f686ce403cb2693f.js +1 -0
- package/assets/esri/core/workers/chunks/852f4cd514008fee5a55.js +1 -0
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +1 -0
- package/assets/esri/core/workers/chunks/{50d5d6654ada9f28345d.js → 85e65ced3312bf9cf162.js} +1 -1
- package/assets/esri/core/workers/chunks/8a3bff0f58483c1665f9.js +1 -0
- package/assets/esri/core/workers/chunks/8b046e28f879079caada.js +1 -0
- package/assets/esri/core/workers/chunks/8d738e9acc2f222235ea.js +1 -0
- package/assets/esri/core/workers/chunks/{b9848bdbaf3d9ac93d54.js → 8f4cd30ce23e41c1a42c.js} +1 -1
- package/assets/esri/core/workers/chunks/9103eb0b9078019d3a26.js +1 -0
- package/assets/esri/core/workers/chunks/915e2711d3a2cfa402b2.js +1 -0
- package/assets/esri/core/workers/chunks/91f9e0e3662d4bf9f163.js +1 -0
- package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +1 -0
- package/assets/esri/core/workers/chunks/99c161fecae710b53b40.js +1 -0
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +1 -0
- package/assets/esri/core/workers/chunks/9a5ef33d99a8f89956ff.js +1 -0
- package/assets/esri/core/workers/chunks/9d10db72e342fe63c981.js +1 -0
- package/assets/esri/core/workers/chunks/{bef27a25fbc4a6e19ec0.js → 9d6491f996eeb0c646ed.js} +1 -1
- package/assets/esri/core/workers/chunks/a015c2f54eb91e43a1f4.js +1 -0
- package/assets/esri/core/workers/chunks/a242ec19a7508de436da.js +1 -0
- package/assets/esri/core/workers/chunks/a320998f18922a35899f.js +1 -0
- package/assets/esri/core/workers/chunks/a7f9f478bd1493fc3c76.js +1 -0
- package/assets/esri/core/workers/chunks/aac6a57edd7494125204.js +1 -0
- package/assets/esri/core/workers/chunks/b73c146d3e550eaf07eb.js +1 -0
- package/assets/esri/core/workers/chunks/b7af0e6b9aadbcaf6a0b.js +1 -0
- package/assets/esri/core/workers/chunks/b803e7b0d489bb628d72.js +1 -0
- package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +1 -0
- package/assets/esri/core/workers/chunks/baeb96aef03d4c566af7.js +1 -0
- package/assets/esri/core/workers/chunks/bc75ab48f4c7609ef09d.js +1 -0
- package/assets/esri/core/workers/chunks/bc78937986854e500b8e.js +1 -0
- package/assets/esri/core/workers/chunks/{6ef3b8d67b498d655a99.js → bcb021a167580bb1619f.js} +1 -1
- package/assets/esri/core/workers/chunks/bd10d21545bca9a49de0.js +1 -0
- package/assets/esri/core/workers/chunks/bec3ee5ea945e1e07a35.js +1 -0
- package/assets/esri/core/workers/chunks/{5c663d5f98bdfa29151b.js → bf8f603848bad4a7deb4.js} +1 -1
- package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +2 -0
- package/assets/esri/core/workers/chunks/c31ee5617c61a933cb0e.js +1 -0
- package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +1 -0
- package/assets/esri/core/workers/chunks/ce7ef7c4ca14d66d96f6.js +1 -0
- package/assets/esri/core/workers/chunks/{f5c57ff48ca505ed701d.js → cf14b3a44705dacefac4.js} +1 -1
- package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +1 -0
- package/assets/esri/core/workers/chunks/{06df187a116709f69952.js → d35c475f004367e333eb.js} +1 -1
- package/assets/esri/core/workers/chunks/d3b086eb9aa8c7d09048.js +1 -0
- package/assets/esri/core/workers/chunks/d55cef8199b8246fea3f.js +1 -0
- package/assets/esri/core/workers/chunks/d82da31dc702b8fd6a07.js +1 -0
- package/assets/esri/core/workers/chunks/d8decaee2c780e1b5e35.js +1 -0
- package/assets/esri/core/workers/chunks/{41809c16544ec25120fa.js → d95ffd990b3a7df69e1e.js} +1 -1
- package/assets/esri/core/workers/chunks/dc54d4a9fe1691862356.js +1 -0
- package/assets/esri/core/workers/chunks/dd4f431511edd975a53b.js +1 -0
- package/assets/esri/core/workers/chunks/dda2cb5c073d1e65f14f.js +1 -0
- package/assets/esri/core/workers/chunks/e18badd11f360cc2912b.js +1 -0
- package/assets/esri/core/workers/chunks/{e25a684eb9f025bdcc01.js → e262c4864dc06c43b380.js} +1 -1
- package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +1 -0
- package/assets/esri/core/workers/chunks/{99101789035f1787c630.js → e785f76c1a75cb1d1e1f.js} +1 -1
- package/assets/esri/core/workers/chunks/e9c5c295b6bf10e942a4.js +1 -0
- package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +1 -0
- package/assets/esri/core/workers/chunks/{873c1b705ac3d4e6c384.js → ea97619a4470f1540b99.js} +1 -1
- package/assets/esri/core/workers/chunks/eaab5ac049622986e3bc.js +1 -0
- package/assets/esri/core/workers/chunks/edee616b6f1b5be8fd39.js +1 -0
- package/assets/esri/core/workers/chunks/ef0085aa743b33cb549f.js +1 -0
- package/assets/esri/core/workers/chunks/f0250cecb243b32cdba7.js +1 -0
- package/assets/esri/core/workers/chunks/f518835b2dc89a48cfb1.js +1 -0
- package/assets/esri/core/workers/chunks/f590b60fca607d66001a.js +1 -0
- package/assets/esri/core/workers/chunks/{f6d047358d14328f3622.js → f60292d97bcdbf19165b.js} +1 -1
- package/assets/esri/core/workers/chunks/f6c8e93ca2987e83f925.js +1 -0
- package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +1 -0
- package/assets/esri/themes/base/widgets/_Sketch.scss +32 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/aiServices.js +1 -1
- package/chunks/geometryEngineBase.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/core/workers/registry.js +1 -1
- package/form/elements/AttachmentElement.d.ts +15 -16
- package/form/elements/FieldElement.js +1 -1
- package/form/elements/GroupElement.d.ts +3 -2
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +7 -9
- package/form/elements/inputs/attachments/AudioInput.d.ts +6 -8
- package/form/elements/inputs/attachments/DocumentInput.d.ts +5 -7
- package/form/elements/inputs/attachments/ImageInput.d.ts +6 -8
- package/form/elements/inputs/attachments/Input.d.ts +2 -6
- package/form/elements/inputs/attachments/SignatureInput.d.ts +5 -7
- package/form/elements/inputs/attachments/VideoInput.d.ts +6 -8
- package/form/elements/inputs/attachments/types.d.ts +3 -3
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/geometryEngineJSON.js +1 -1
- package/geometry/operators/projectOperator.d.ts +5 -4
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/normalizeUtils.js +1 -1
- package/geometry/support/normalizeUtilsCommon.js +1 -1
- package/graphic/ImageryGraphicOrigin.js +1 -1
- package/graphic/ImageryTileGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/SymbolLayerDrawing.d.ts +18 -4
- package/package.json +4 -4
- package/popup/Features.d.ts +9 -9
- package/popup/Features.js +1 -1
- package/popup/actionUtils.js +1 -1
- package/popup/actions.js +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalQueryParams.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/DimensionController.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/state/GoToOperation.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/support/cameraScaleUtils.js +2 -0
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/renderInfoUtils/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +13 -12
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/SceneView.d.ts +1 -0
- package/views/VideoView.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/editingSessionUtils.js +2 -0
- package/views/draw/support/managers/MeasurementManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +9 -1
- package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
- package/views/support/GeometryWorker.js +2 -0
- package/views/support/GeometryWorkerHandle.js +2 -0
- package/views/support/Scheduler.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -3
- package/widgets/FeatureTable/Grid/GridViewModel.d.ts +2 -11
- package/widgets/FeatureTable/support/types.d.ts +2 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +28 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer.d.ts +27 -0
- package/widgets/Sketch/SketchViewModel.d.ts +10 -2
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/MeasuredContentGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +0 -1
- package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +0 -1
- package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +0 -1
- package/assets/esri/core/workers/chunks/0783890816bac45277b9.js +0 -1
- package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +0 -1
- package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +0 -1
- package/assets/esri/core/workers/chunks/0dad0bca8d58b2c63d22.js +0 -1
- package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +0 -1
- package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +0 -1
- package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +0 -1
- package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +0 -1
- package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +0 -1
- package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +0 -1
- package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +0 -1
- package/assets/esri/core/workers/chunks/266ba61b72a278d93a26.js +0 -1
- package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +0 -1
- package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +0 -1
- package/assets/esri/core/workers/chunks/29e76256e3e867e80520.js +0 -1
- package/assets/esri/core/workers/chunks/2abf124e2956e4f76688.js +0 -1
- package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +0 -1
- package/assets/esri/core/workers/chunks/30f04dc001eaf838d64c.js +0 -1
- package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +0 -1
- package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +0 -1
- package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +0 -1
- package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +0 -1
- package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +0 -1
- package/assets/esri/core/workers/chunks/43678e08a3d9d51c2a6d.js +0 -1
- package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +0 -1
- package/assets/esri/core/workers/chunks/47f2113357b2aa4f4f37.js +0 -1
- package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +0 -1
- package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +0 -1
- package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +0 -1
- package/assets/esri/core/workers/chunks/55369c5bd65bcaf78da1.js +0 -1
- package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +0 -1
- package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +0 -1
- package/assets/esri/core/workers/chunks/5a83ea967ecde01d5622.js +0 -1
- package/assets/esri/core/workers/chunks/5b278b9980752ef495a2.js +0 -1
- package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +0 -1
- package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +0 -1
- package/assets/esri/core/workers/chunks/5e59ff96aecdf2adcb3b.js +0 -1
- package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +0 -1
- package/assets/esri/core/workers/chunks/6a21c9a4aeebe806ea39.js +0 -1
- package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +0 -1
- package/assets/esri/core/workers/chunks/6d11ec355e5474b2968b.js +0 -1
- package/assets/esri/core/workers/chunks/6ea8b0d68881d16a2432.js +0 -1
- package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +0 -1
- package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +0 -1
- package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +0 -1
- package/assets/esri/core/workers/chunks/74be994d789c57031631.js +0 -1
- package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +0 -1
- package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +0 -1
- package/assets/esri/core/workers/chunks/770880ad43f252962017.js +0 -1
- package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +0 -1
- package/assets/esri/core/workers/chunks/7a56c836c89a8b978800.js +0 -1
- package/assets/esri/core/workers/chunks/81750c5177d8d52a3e05.js +0 -1
- package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +0 -1
- package/assets/esri/core/workers/chunks/84772b023d04e415f17f.js +0 -1
- package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +0 -1
- package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +0 -1
- package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +0 -1
- package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +0 -1
- package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +0 -1
- package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +0 -2
- package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +0 -1
- package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +0 -1
- package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +0 -1
- package/assets/esri/core/workers/chunks/a94bd20551c1179c7ec5.js +0 -1
- package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +0 -1
- package/assets/esri/core/workers/chunks/af5db0372d526e592fcc.js +0 -1
- package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +0 -1
- package/assets/esri/core/workers/chunks/bc53ce9a643f82d516c2.js +0 -1
- package/assets/esri/core/workers/chunks/bc887bd62579dba81e2b.js +0 -1
- package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +0 -1
- package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +0 -1
- package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +0 -1
- package/assets/esri/core/workers/chunks/c327fe276238af60fda4.js +0 -1
- package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +0 -1
- package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +0 -1
- package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +0 -1
- package/assets/esri/core/workers/chunks/d21fdd67477800101f3b.js +0 -1
- package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +0 -2
- package/assets/esri/core/workers/chunks/d8d7331600d93bbca2b4.js +0 -1
- package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +0 -1
- package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +0 -1
- package/assets/esri/core/workers/chunks/e1bc9ad767e08dc18bbc.js +0 -1
- package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +0 -1
- package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +0 -1312
- package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +0 -1
- package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +0 -1
- package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +0 -1
- package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +0 -1
- package/assets/esri/core/workers/chunks/f43a63094190d2074cd0.js +0 -1
- package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +0 -1
- package/assets/esri/core/workers/chunks/fa160a2a5dc9f5a7c34b.js +0 -1
- package/geometry/support/triangulationUtilsDeprecated.js +0 -2
- package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +0 -2
- package/views/3d/support/renderInfoUtils/polygonDeprecated.js +0 -2
- package/views/support/MeasurementWorker.js +0 -2
- package/views/support/MeasurementWorkerHandle.js +0 -2
- /package/assets/esri/core/workers/chunks/{9eb4ae556950e1d0124d.js.LICENSE.txt → 07aca5ecad659d55e795.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d65b1234867f7d773d50.js.LICENSE.txt → bfe575da727ce7c8d331.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as k}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as H,getEndpoint as O,isCircularArc as L,isEllipticArc4 as P,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as $}from"./drawUtils.js";import q from"./GraphicMover.js";import X from"./HighlightHelper.js";import{addUniqueLayer as Y,isConnectedReshapeSupportedLayer as Z}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MeasurementWorkerHandle as Mt}from"../../support/MeasurementWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new X({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;Y(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:t,activeTooltipInfo:e,graphic:i}=this;return{sketchOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new q({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=H(n)[t][i];if(s){const t=O(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}if(this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag))return this.refresh(),void this._connectedReshapeManager?.finish();this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||P(r)){const i=O(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=W(this.snappingManager)??i.z,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}})}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Pt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),Pt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=$(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);Pt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?kt(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(Pt(e,i,s,o,r),n&&(0===s?Pt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(P(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function kt(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ht(t,e){return t<1e-8*e}function Ot(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ht(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ht(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:k(t,r)}function Pt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||P(r)){const o=O(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Ot(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||P(n)){const o=O(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Ot(o,r,s,!1)]})}else if(j(n)){const t=O(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Z(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_({type:ft})],Et.prototype,"sketchOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as k}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as H,getEndpoint as O,isCircularArc as L,isEllipticArc4 as P,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as $}from"./drawUtils.js";import q from"./GraphicMover.js";import X from"./HighlightHelper.js";import{addUniqueLayer as Y,isConnectedReshapeSupportedLayer as Z}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Mt}from"../../support/GeometryWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new X({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;Y(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:t,activeTooltipInfo:e,graphic:i}=this;return{sketchOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new q({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=H(n)[t][i];if(s){const t=O(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}if(this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag))return this.refresh(),void this._connectedReshapeManager?.finish();this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||P(r)){const i=O(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=W(this.snappingManager)??i.z,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}})}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Pt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),Pt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=$(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);Pt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?kt(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(Pt(e,i,s,o,r),n&&(0===s?Pt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(P(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function kt(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ht(t,e){return t<1e-8*e}function Ot(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ht(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ht(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:k(t,r)}function Pt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||P(r)){const o=O(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Ot(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||P(n)){const o=O(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Ot(o,r,s,!1)]})}else if(j(n)){const t=O(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Z(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_({type:ft})],Et.prototype,"sketchOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{createTask as t}from"../../../core/asyncUtils.js";import{throwIfAborted as e,isAborted as r}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{diff as i}from"../../../core/accessorSupport/diffUtils.js";import{isGraphicsLayer as a,isSceneLayer as o}from"../../../layers/support/layerUtils.js";import{getDisplayedSymbol as n}from"../../../symbols/support/symbolUtils.js";import{GraphicState as c}from"../../3d/layers/graphics/GraphicState.js";async function l(t,r,s,i){const a=r.createQuery();a.objectIds=t,a.outFields=["*"],a.returnM=r.capabilities.data.supportsM,a.returnZ=r.capabilities.data.supportsZ,a.returnGeometry=!0,o(r)&&null!=r.infoFor3D||(a.outSpatialReference=s),!o(r)&&r.capabilities?.data.supportsTrueCurve&&(a.returnTrueCurves=!0);const n=await r.queryFeatures(a,{signal:i});return e(i),n.features}async function y(t,r,s,a){const o=await n(t,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:r,scale:s});e(a);null!=i(t.symbol,o)&&(t.symbol=o)}async function u(i,o,n,c,l){e(l);const y=n.sourceLayer,u=n.layer??y,m=n.getObjectId();let f=null,b=null;function w(s){f?.abort(),a(u)?n.visible=s:f=t(async t=>{const i=await p(o,u);if(e(t),i&&!o.destroyed&&!i.destroyed)try{null!=m&&"number"==typeof m&&"setVisibility"in i&&i.setVisibility?.(m,s)}catch(a){if(r(t)||o.destroyed||i.destroyed)return;throw a}})}async function h(){return b||(b=(async()=>{w(!0);try{const t=o.destroyed?null:await p(o,u).catch(()=>{});t&&!t.destroyed&&await s(()=>!t.updating)}finally{i.remove(c)}})(),b)}i.add(c);try{await d(o,c,l),e(l),w(!1)}catch(v){throw await h(),v}const j=async()=>h();return{remove:j,[Symbol.asyncDispose]:()=>j()}}async function p(t,e){if(!e||"building-component"===e.type)return;const r="subtype-sublayer"===e.type?e.parent:e;return r?t.whenLayerView(r):void 0}async function d(t,e,r){if("3d"===t.type){const i=new c({graphic:e}),a=t.trackGraphicState(i);try{await s(()=>i.displaying||i.error,r)}finally{a.remove()}}else await s(()=>e.visible,r)}export{l as fetchFullFeaturesByObjectId,u as swapForEditingSession,y as updateGraphicSymbolWhenRequired};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{GeometryWorkerHandle as u}from"../../../support/GeometryWorkerHandle.js";let m=class extends r{constructor(){super(...arguments),this._updatingHandles=new i,this._pluginAbortControllers=new WeakMap}destroy(){this._measurementWorker=s(this._measurementWorker)}get updating(){return this._updatingHandles.updating}get test(){return{overrideUtils:e=>{this._measurementWorker?.destroy(),this._measurementWorker=e}}}preloadMeasurementUtils(){this._measurementWorker??=new u({preloadGeodetic:!0})}suspendPlugin(e){const r=this._pluginAbortControllers.get(e);r?.forEach(e=>e.abort()),r?.clear()}async measureArea(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoArea2D(t,{unit:s},n.signal)?.then(({area:e})=>e))}async measureLength(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoLength2D(t,{unit:s},n.signal))}async measureDistance(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoDistance2DBetweenPoints(t[0],t[1],{unit:s},n.signal))}_setupAbortController(e,r){const s=t(this._pluginAbortControllers,e,()=>new Map);s.get(r)?.abort();const o=new AbortController;return s.set(r,o),o}};e([n()],m.prototype,"updating",null),m=e([a("esri.views.draw.support.managers.MeasurementManager")],m);export{m as MeasurementManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as s}from"../../intl.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import{multiplyOpacity as i,getContrast as a}from"../../core/colorUtils.js";import{makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as l}from"../../core/MapUtils.js";import{deg2rad as d}from"../../core/mathUtils.js";import{debounce as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as b,set as x,normalize as y,scale as v,add as U,lerp as j}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as L}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as I}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as k}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polyline.js";import{isClockwise as P}from"../../geometry/support/coordsUtils.js";import{getEndpoint as T,isCoordinate as H,cloneCurve as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as s}from"../../intl.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import{multiplyOpacity as i,getContrast as a}from"../../core/colorUtils.js";import{makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as l}from"../../core/MapUtils.js";import{deg2rad as d}from"../../core/mathUtils.js";import{debounce as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as b,set as x,normalize as y,scale as v,add as U,lerp as j}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as L}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as I}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as k}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polyline.js";import{isClockwise as P}from"../../geometry/support/coordsUtils.js";import{getEndpoint as T,isCoordinate as H,cloneCurve as D}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as M}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as O}from"../../intl/messages.js";import{getConvertedElevationFromVector as S,absoluteHeightElevationInfo as G}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as R}from"../../support/getDefaultUnitForView.js";import A from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as V}from"../support/GeometryWorkerHandle.js";const W=3025,N={default:15,far:25};let q=class extends o{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._updatingHandles=new C,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new V({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),m(()=>this.context?.editGeometryOperations,["vertex-add","vertex-remove"],()=>this._update()),m(()=>this.context?.editGeometryOperations,"vertex-update",e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),s(()=>this._refreshMessages()),n(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return N[this.edgeDistance]}get _colors(){const e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:i(a(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;const{context:t,stagedVertex:s}=this;if(!t)return this._destroyUnusedLabels();const o=t.editGeometryOperations.data,{parts:r,geometry:i,coordinateHelper:a}=o;if(!i)return this._destroyUnusedLabels();const n=r.length;for(let l=0;l<n;++l){const r=this.getRing(i,o,s,a,l),d=r.map(e=>k(e)?e:a.arrayToXYZ(T(e)));if(r.length<2||!z(r,t.view,t.elevationInfo,a.spatialReference))continue;const c=1===n&&!P(d);let p=Z,m=B;this.toScreenPointArray(t,d[0],p);for(let s=1;s<r.length;++s){const o=d[s-1],i=d[s],a=r[s];this.toScreenPointArray(t,i,m);const n=s===d.length-1,h=!(!e?.length||e.some(({index:e,part:t})=>t.index===l&&(e===s-1||e===s||n&&0===e)));this._addLabel(t,o,p,i,k(a)?null:a,m,c,h),[p,m]=[m,p]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){const s=this._nextLabelIndex,o=this._labelInfos;for(let r=0;r<s;++r){const{label:s}=o[r];s.textColor=e,s.backgroundColor=t}}_updateLabelMeasurement(e,t,s,o,r){return l(this._debouncedLabelUpdates,o,()=>c(async(e,t,s,o,r)=>{const{spatialReference:i,coordinateHelper:a}=e.editGeometryOperations.data,n=!r||H(r),l=await(n?this._measurementWorker.autoDistance2DBetweenPoints(a.arrayToPoint(t),a.arrayToPoint(s)):this._measurementWorker.autoLength2D(new w({spatialReference:i,curvePaths:[[[t[0],t[1]],r]]})));if(o.destroyed)return;const d=this._messagesUnits,c=R(e.view);o.text=null==d||null==l||Number.isNaN(l.value)?"":p(d,l,c)}))(e,I(t),I(s),o,r?D(r):void 0)}_addLabel(e,t,s,o,r,i,a,n=!1){const{label:l,wasReused:d}=this._getOrCreateLabel(e);if(!this.visible||b(s,i)<W)return void(l.visible=!1);const{coordinateHelper:c}=e.editGeometryOperations.data;n&&d||this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,o,l,r)),l.visible=!0;const p=i[0]-s[0],m=i[1]-s[1];if(a?x(X,-m,p):x(X,m,-p),y(X,X),v(X,X,this._edgeDistancePixels),r&&!H(r)){const s=c.arrayToXYZ(M(t,r,.5)),o=this.toScreenPointArray(e,s);U(Y,o,X)}else j(Y,s,i,.5),U(Y,Y,X);l.position=[Y[0],Y[1]],Math.abs(X[0])>Math.abs(X[1])?l.anchor=X[0]>0?"left":"right":l.anchor=-X[1]<0?"top":"bottom"}_getOrCreateLabel(e){const t=this._labelInfos.length>this._nextLabelIndex,{textColor:s,backgroundColor:o}=this._colors;if(t){const e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=s,t.backgroundColor=o,e.wasReused=!0,e}const r=new A({anchor:"center",fontSize:8,textColor:s,backgroundColor:o});e.view.overlay?.items.add(r);const i={label:r,wasReused:!1};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=r(()=>O("esri/core/t9n/Units"))}};function z(e,t,s,o){if("2d"===t.type)return!0;const r=u(o)??1,i=f(o),a=e=>S(t,e,o,s,G)??0;for(let n=1;n<e.length;++n){const t=e[n-1],s=e[n];if(!k(t)||!k(s))return!1;const o=(s[0]-t[0])*r,l=(s[1]-t[1])*r,d=(a(s)-a(t))*i;if(Math.abs(d)/Math.sqrt(o*o+l*l)>F)return!1}return!0}e([g()],q.prototype,"context",void 0),e([g()],q.prototype,"stagedVertex",void 0),e([g()],q.prototype,"visible",void 0),e([g()],q.prototype,"edgeDistance",void 0),e([g()],q.prototype,"updating",null),e([g()],q.prototype,"_messageUnitsTask",void 0),e([g()],q.prototype,"_messagesUnits",null),e([g()],q.prototype,"_edgeDistancePixels",null),e([g()],q.prototype,"_colors",null),q=e([_("esri.views.interactive.SegmentLabels")],q);const F=d(5),X=L(),Y=L(),Z=h(),B=h();export{q as SegmentLabels};
|
|
@@ -3,7 +3,7 @@ import type SketchTooltipVisibleElements from "./SketchTooltipVisibleElements.js
|
|
|
3
3
|
import type { Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
4
4
|
import type { SketchTooltipVisibleElementsProperties } from "./SketchTooltipVisibleElements.js";
|
|
5
5
|
|
|
6
|
-
export interface SketchTooltipOptionsProperties extends Partial<Pick<SketchTooltipOptions, "enabled" | "helpMessage" | "helpMessageIcon" | "inputEnabled">> {
|
|
6
|
+
export interface SketchTooltipOptionsProperties extends Partial<Pick<SketchTooltipOptions, "enabled" | "forceEnabled" | "helpMessage" | "helpMessageIcon" | "inputEnabled">> {
|
|
7
7
|
/** The elements that are displayed within the tooltip while sketching. */
|
|
8
8
|
visibleElements?: SketchTooltipVisibleElementsProperties;
|
|
9
9
|
}
|
|
@@ -94,6 +94,14 @@ export default class SketchTooltipOptions extends Accessor {
|
|
|
94
94
|
* @default false
|
|
95
95
|
*/
|
|
96
96
|
accessor enabled: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Temporary override option for `enabled`. Can for example be used to allow a keybinding to
|
|
99
|
+
* temporarily show the tooltips.
|
|
100
|
+
*
|
|
101
|
+
* @default false
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
accessor forceEnabled: boolean;
|
|
97
105
|
/**
|
|
98
106
|
* A custom help message that is displayed at the bottom of the tooltip. If not set, the default
|
|
99
107
|
* help message based on the current state of the tool is shown.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as s}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as o,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as r}from"./LineSnapper.js";import{ParallelLineSnapper as n}from"./ParallelLineSnapper.js";import{RightAngleSnapper as p}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as m}from"./snappingUtils.js";import{
|
|
2
|
+
import{__decorate as s}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as o,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as r}from"./LineSnapper.js";import{ParallelLineSnapper as n}from"./ParallelLineSnapper.js";import{RightAngleSnapper as p}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as m}from"./snappingUtils.js";import{GeometryWorkerHandle as h}from"../../support/GeometryWorkerHandle.js";let f=class extends t{constructor(s){super(s),this.updating=!1,this._measurementWorker=new h,this._snappers=new e,this._domain=2}initialize(){this._snappers.push(new n(this.view,this.options),new r(this.view,this.options,this._measurementWorker),new p(this.view,this.options,this._measurementWorker),new a(this.view,this.options))}destroy(){this._measurementWorker.destroy()}set options(s){this._set("options",s);for(const t of this._snappers)t.options=s}async fetchCandidates(s,t,e){if(!(t&this._domain)||!this.options.effectiveSelfEnabled||e.suppressSelfSnapping)return[];const o=[];for(const i of this._snappers.items)for(const t of await i.snap(s,e))o.push(t);return m(s,o),o}};s([o({readOnly:!0})],f.prototype,"updating",void 0),s([o({constructOnly:!0})],f.prototype,"view",void 0),s([o()],f.prototype,"options",null),f=s([i("esri.views.interactive.snapping.SelfSnappingEngine")],f);export{f as SelfSnappingEngine};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{max as t,createLength as e,createArea as o}from"../../core/quantity.js";import{deriveLengthUnitFromAreaUnit as r}from"../../core/units.js";import{set as n,scale as i,normalize as s,cross as a,subtract as c,dot as m,add as f}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as p,isSphericalECEF as l}from"../../geometry/ellipsoidUtils.js";import g from"../../geometry/Multipoint.js";import y from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import h from"../../geometry/Polyline.js";import{projectWithoutEngine as S}from"../../geometry/projectionUtils.js";import J from"../../geometry/SpatialReference.js";import{WGS84ECEFSpatialReference as N,getSphericalPCPF as d,SphericalECEFSpatialReference as j}from"../../geometry/spatialReferenceEllipsoidUtils.js";import{e as R}from"../../chunks/areaOperator.js";import{e as w}from"../../chunks/centroidOperator.js";import{e as k}from"../../chunks/distanceOperator.js";import{l as v,e as P}from"../../chunks/geodeticAreaOperator.js";import{load as U,execute as x}from"../../geometry/operators/geodeticDistanceOperator.js";import{l as L,e as M}from"../../chunks/geodeticLengthOperator.js";import{e as b}from"../../chunks/lengthOperator.js";import{e as C}from"../../chunks/simplifyOperator.js";import{projectDirection as E}from"../../geometry/projection/projectDirection.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";import{isWGS84 as z,isWebMercator as Z,isCGCS2000 as D,equals as W}from"../../geometry/support/spatialReferenceUtils.js";import{makeOrthonormal as $}from"../3d/support/mathUtils.js";import{autoMeasurementMode as A}from"./measurementWorkerUtils.js";async function I({geometryJSON:t,options:e}){await Promise.allSettled([v(),e?.returnLength?L():void 0]);const n=F(t,e),i=e?.unit??"square-meters",s=C(n)??n,a=P(s,{unit:i,...e}),c=o(a,i),m=e?.lengthUnit??r(i);return{area:c,centroid:e?.returnCentroid?G(s).toJSON():void 0,length:e?.returnLength?await H(s,{unit:m}):void 0}}function B(){v(),L(),U()}function F(t,e){const o="rings"in t?O.fromJSON(t):h.fromJSON(t);if(e?.stagedPoint){const t=y.fromJSON(e.stagedPoint),r=("rings"in o?o.rings:o.paths).at(-1);if(r){const{x:e,y:n,z:i,m:s}=t,a=o.hasZ&&o.hasM?[e,n,i??0,s??0]:o.hasZ?[e,n,i??0]:o.hasM?[e,n,s??0]:[e,n];r.push(a)}}return o}function G(t){return w(t)}async function H(t,o){await L();const r=o?.unit??"meters";return e(M(t,{...o,unit:r}),r)}function K({geometryJSON:t,options:e}){return H(F(t,e),e)}async function Q({geometry1JSON:t,geometry2JSON:o,options:r}){await U();const n=y.fromJSON(t),i=y.fromJSON(o),s=r?.unit??"meters";return e(x(n,i,{...r,unit:s}),s)}async function T({geometry1JSON:t,geometry2JSON:o,options:r}){await U();const n=g.fromJSON(t),i=g.fromJSON(o);if(n.points.length!==i.points.length)throw new Error("Input multipoints must have the same number of points.");const s=n.points.length,a=r?.unit??"meters",c=[],m={...r,unit:a};for(let f=0;f<s;f++){const t=n.getPoint(f),o=i.getPoint(f);c.push(null!=t&&null!=o?e(x(t,o,m),a):null)}return c}function V({geometryJSON:t,options:e}){return X(F(t,e),e)}function X(t,e){const n=e?.unit??"square-meters",i=e?.lengthUnit??r(n),s=C(t)??t,a=R(s,{unit:n,...e});return{area:o(a,n),centroid:e?.returnCentroid?G(s).toJSON():void 0,length:e?.returnLength?Y(s,{unit:i}):void 0}}function Y(t,o){const r=o?.unit??"meters";return e(b(t,{...o,unit:r}),r)}function _({geometryJSON:t,options:e}){return Y(F(t,e),e)}function tt({geometry1JSON:t,geometry2JSON:o,options:r}){const n=y.fromJSON(t),i=y.fromJSON(o),s=r?.unit??"meters";return e(k(n,i,{...r,unit:s}),s)}async function et(t){return it(t.geometryJSON.spatialReference,I,V)(t)}async function ot(t){return it(t.geometryJSON.spatialReference,K,_)(t)}async function rt(t){return it(t.geometry1JSON.spatialReference,Q,tt)(t)}async function nt(e){const o=it(e.topLeftJSON.spatialReference,Q,tt),{topLeftJSON:r,topRightJSON:n,bottomRightJSON:i,bottomLeftJSON:s,options:a}=e,[c,m,f,u]=await Promise.all([o({geometry1JSON:s,geometry2JSON:i,options:a}),o({geometry1JSON:r,geometry2JSON:n,options:a}),o({geometry1JSON:i,geometry2JSON:n,options:a}),o({geometry1JSON:s,geometry2JSON:r,options:a})]);return{width:t(c,m),height:t(u,f)}}function it(t,e,o){switch(A(t)){case 0:return e;case 1:return o}}function st(t){const{geometryJSON:e}=t,o=ut(e.spatialReference);if(!o)throw new Error("Cannot compute horizontal area without a valid spatial reference.");switch(o.mode){case 0:return V(t);case 1:return ct(o,t)}}function at({geometryJSON:t}){const e=q(t);if(!e)return null;const o=C(e);return o?o.toJSON():null}function ct(t,{geometryJSON:e,options:o}){const r=F(e,o),n=gt,i=pt,s=lt,a=W(r.spatialReference,t.spatialReference)?r.clone():S(r,r.spatialReference,t.spatialReference);if(!a)throw new Error(`Cannot project geometry from ${r.spatialReference?.wkid??"unknown"} to ${t.spatialReference.wkid}.`);ft(a,n,i,s);const{area:c,centroid:m,length:f}=X(a,o);return{area:c,centroid:mt(m,n,i,s,t.spatialReference,r.spatialReference),length:f}}function mt(t,e,o,r,n,s){if(!t)return t;i(o,o,t.x),i(r,r,t.y);const a=yt;return f(a,o,r),f(a,a,e),t.x=a[0],t.y=a[1],t.z=a[2],t.spatialReference=n,S(t,t.spatialReference,s)?.toJSON()??void 0}function ft(t,e,o,r){let f=0;n(e,0,0,0);for(const n of t.rings)for(const t of n)e[0]+=t[0],e[1]+=t[1],e[2]+=t[2],f++;i(e,e,1/f);const u=Ot;s(u,e);const p=ht,l=Math.atan2(u[1],u[0]);n(p,-Math.sin(l),Math.cos(l),0),W(t.spatialReference,N)&&(E(e,u,j,u,t.spatialReference),E(e,p,j,p,t.spatialReference)),$(p,u,o),a(r,o,u);const g=yt;for(const i of t.rings)for(const t of i){n(g,t[0],t[1],t[2]),c(g,g,e);const i=m(o,g),s=m(r,g);t[0]=i,t[1]=s}t.hasZ=!1,t.spatialReference=J.WebMercator}function ut(t){return t?p(t)?z(t)||Z(t)||D(t)||l(t)||W(t,N)?{mode:1,spatialReference:N}:{mode:0,spatialReference:t}:{mode:1,spatialReference:d(t)}:null}const pt=u(),lt=u(),gt=u(),yt=u(),Ot=u(),ht=u();export{V as area2D,st as areaHorizontal,et as autoArea2D,rt as autoDistance2DBetweenPoints,ot as autoLength2D,nt as autoSize2D,tt as distance2DBetweenPoints,I as geodeticArea,Q as geodeticDistanceBetweenPoints,T as geodeticDistanceBetweenPointsMany,K as geodeticLength,_ as length2D,B as preloadGeodetic,at as simplify};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{ignoreAbortErrors as t}from"../../core/promiseUtils.js";import{WorkerHandle as e}from"../../core/workers/WorkerHandle.js";import o from"../../geometry/Point.js";import{fromJSON as n}from"../../geometry/support/jsonUtils.js";class i extends e{constructor(t){super("GeometryWorker","geodeticArea",{},void 0,{strategy:"distributed"}),t?.preloadGeodetic&&this._preloadGeodetic()}async geodeticArea(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("geodeticArea",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}geodeticLength(t,e,o){const n=t.toJSON();return this.invokeMethod("geodeticLength",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}geodeticDistanceBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("geodeticDistanceBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}geodeticDistanceBetweenPointsMany(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("geodeticDistanceBetweenPointsMany",{geometry1JSON:i,geometry2JSON:r,options:o},n)}_preloadGeodetic(){t(this.broadcast(void 0,"preloadGeodetic"))}async area2D(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("area2D",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}length2D(t,e,o){const n=t.toJSON();return this.invokeMethod("length2D",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}distance2DBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("distance2DBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}async areaHorizontal(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("areaHorizontal",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}async autoArea2D(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("autoArea2D",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}async autoLength2D(t,e,o){const n=t.toJSON();return this.invokeMethod("autoLength2D",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}autoDistance2DBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("autoDistance2DBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}autoSize2D(t,e,o,n,i,r){const s=t.toJSON(),a=e.toJSON(),d=o.toJSON(),g=n.toJSON();return this.invokeMethod("autoSize2D",{topLeftJSON:s,topRightJSON:a,bottomRightJSON:d,bottomLeftJSON:g,options:i},r)}async simplify(t,e){const o=t.toJSON(),i=await this.invokeMethod("simplify",{geometryJSON:o},e);return i?n(i):null}}export{i as GeometryWorkerHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import{recordPerformance as a}from"../../core/performance.js";import n from"../../core/PerformanceSampler.js";import{isAborted as u,createAbortError as _,when as h,isPromiseLike as o,ignoreAbortErrors as E}from"../../core/promiseUtils.js";import{watch as d,initial as T,when as c}from"../../core/reactiveUtils.js";import{signal as m}from"../../core/signal.js";import{Milliseconds as l}from"../../core/time.js";import R from"./debugFlags.js";import{PromiseQueue as g}from"./PromiseQueue.js";import{Yield as I}from"./Yield.js";function A(){return new C}const p={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S:"I3S",LYR3D:"Lyr3D",TILES3D:"3DTiles",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OCCLUSION_QUERY:"occlusion query",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",VOLUME_MEASUREMENT:"volume measurement",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",GAUSSIAN_SPLAT_SORTING:"gaussian splat sorting",GAUSSIAN_SPLAT_TEXTURE_ATLAS:"gaussian splat texture atlas",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},L=0,f=new Map([[p.RESOURCE_CONTROLLER_IMMEDIATE,L],[p.RESOURCE_CONTROLLER,4],[p.SLIDE,L],[p.STREAM_DATA_LOADER,L],[p.ELEVATION_QUERY,L],[p.TERRAIN_SURFACE,1],[p.SURFACE_GEOMETRY_UPDATES,1],[p.LOD_RENDERER,2],[p.GRAPHICS_CORE,2],[p.I3S,2],[p.LYR3D,2],[p.TILES3D,2],[p.POINT_CLOUD_LAYER,2],[p.FEATURE_TILE_FETCHER,2],[p.STREAM_CONTROLLER,2],[p.CLOUDS_GENERATOR,2],[p.OCCLUSION_QUERY,2],[p.OVERLAY,4],[p.OVERLAY_RENDERER,4],[p.STAGE,4],[p.GRAPHICS_DECONFLICTOR,4],[p.FILTER_VISIBILITY,4],[p.SCALE_VISIBILITY,4],[p.FRUSTUM_VISIBILITY,4],[p.POINT_OF_INTEREST_FREQUENT,6],[p.POINT_OF_INTEREST_INFREQUENT,30],[p.LABELER,8],[p.FEATURE_QUERY_ENGINE,8],[p.FEATURE_TILE_TREE,16],[p.FEATURE_TILE_TREE_ACTIVE,L],[p.ELEVATION_ALIGNMENT,12],[p.ELEVATION_ALIGNMENT_SCENE,14],[p.TEXT_TEXTURE_ATLAS,12],[p.TEXTURE_UNLOAD,12],[p.LINE_OF_SIGHT_TOOL,16],[p.LINE_OF_SIGHT_TOOL_INTERACTIVE,L],[p.VOLUME_MEASUREMENT,4],[p.SNAPPING,L],[p.SHADOW_ACCUMULATOR,30],[p.FLOW_GENERATOR,12],[p.GAUSSIAN_SPLAT_SORTING,2],[p.GAUSSIAN_SPLAT_TEXTURE_ATLAS,12],[p.MAPVIEW_FETCH_QUEUE,L],[p.MAPVIEW_LAYERVIEW_UPDATE,2],[p.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,L]]);function O(e){return f.has(e)?f.get(e):"number"==typeof e?e:1}const S=l(6.5),N=l(1),U=l(30),b=l(1e3/30),P=l(100),k=.9;class C{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=m(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new F,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=d(()=>R.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,T);for(const e of Object.keys(p))this.performanceInfo.tasks.set(p[e],new n(String(p[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new y(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();this._runFrame();const t=this._budget.now();this._recordFrameTaskTimes(t-e);const s=2===this.state?"Idle":1===this.state?"Interacting":"Animating";return a(`${s} Frame Tasks`,e,t,"Maps SDK","Scheduling"),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=S,s=e.frameDuration,r=N;switch(this.state){case 2:t=l(0),s=l(Math.max(P,e.frameDuration)),r=U;break;case 1:s=l(Math.max(b,e.frameDuration))}return s=l(s-e.elapsedFrameTime-t),2!==this.state&&s<N&&!this._forceTask?(this._forceTask=!0,!1):(s=l(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){this._forceTask=!1,this._microTaskQueued=!1,this._run(),this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(l(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*k+e*(1-k)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===L&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==L&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===I&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,p.I3S,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now(),n=i-t;if(a(`${s.name}`,t,i,"Maps SDK","Scheduling"),s.runtime+=n,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+n),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(p))this._frameTaskTimes.set(p[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class y{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new g,this._handles=new s,this._basePriority=O(t),this.schedulePriority=this._basePriority,this._task=m(null!=r?r:this._queue),this._handles.add(c(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(w),this._scheduler.removeTask(this),this.schedule=G.schedule,this.reschedule=G.reschedule,this.scheduleGenerator=G.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=O(e);this._basePriority!==L&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class F{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const w=new F;function D(e){const t=new F;return t.reset(e),t}w.enabled=!1;class M{remove(){}processQueue(){}schedule(e,t,s){try{if(u(t)){const e=_();return s?Promise.resolve(s(e)):Promise.reject(e)}return h(e(w))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(u(t)){const e=_();if(s)return s(e);throw e}const r=e(w);for(;;){const e=r.next(w),i=o(e)?await e:e;if(u(t)){const e=_();if(s){const t=s(e),i=r.return(null);return o(i)&&await E(i),t}const t=r.throw(e);throw o(t)&&await E(t),e}if(i.done)return i.value}}}const G=new M;export{G as ImmediateTask,p as TaskPriority,O as getTaskPriority,D as makeBudget,A as newScheduler,w as noBudget,f as taskPriorities};
|
|
2
|
+
import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import{recordPerformance as a}from"../../core/performance.js";import n from"../../core/PerformanceSampler.js";import{isAborted as u,createAbortError as _,when as h,isPromiseLike as o,ignoreAbortErrors as E}from"../../core/promiseUtils.js";import{watch as d,initial as T,when as c}from"../../core/reactiveUtils.js";import{signal as m}from"../../core/signal.js";import{Milliseconds as l}from"../../core/time.js";import R from"./debugFlags.js";import{PromiseQueue as g}from"./PromiseQueue.js";import{Yield as I}from"./Yield.js";function A(){return new C}const p={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S:"I3S",LYR3D:"Lyr3D",TILES3D:"3DTiles",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OCCLUSION_QUERY:"occlusion query",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",VOLUME_MEASUREMENT:"volume measurement",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",GAUSSIAN_SPLAT_SORTING:"gaussian splat sorting",GAUSSIAN_SPLAT_TEXTURE_ATLAS:"gaussian splat texture atlas",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},L=0,f=new Map([[p.RESOURCE_CONTROLLER_IMMEDIATE,L],[p.RESOURCE_CONTROLLER,4],[p.SLIDE,L],[p.STREAM_DATA_LOADER,L],[p.ELEVATION_QUERY,L],[p.TERRAIN_SURFACE,1],[p.SURFACE_GEOMETRY_UPDATES,1],[p.LOD_RENDERER,2],[p.GRAPHICS_CORE,2],[p.I3S,2],[p.LYR3D,2],[p.TILES3D,3],[p.POINT_CLOUD_LAYER,2],[p.FEATURE_TILE_FETCHER,2],[p.STREAM_CONTROLLER,2],[p.CLOUDS_GENERATOR,2],[p.OCCLUSION_QUERY,2],[p.OVERLAY,4],[p.OVERLAY_RENDERER,4],[p.STAGE,4],[p.GRAPHICS_DECONFLICTOR,4],[p.FILTER_VISIBILITY,4],[p.SCALE_VISIBILITY,4],[p.FRUSTUM_VISIBILITY,4],[p.POINT_OF_INTEREST_FREQUENT,6],[p.POINT_OF_INTEREST_INFREQUENT,30],[p.LABELER,8],[p.FEATURE_QUERY_ENGINE,8],[p.FEATURE_TILE_TREE,16],[p.FEATURE_TILE_TREE_ACTIVE,L],[p.ELEVATION_ALIGNMENT,12],[p.ELEVATION_ALIGNMENT_SCENE,14],[p.TEXT_TEXTURE_ATLAS,12],[p.TEXTURE_UNLOAD,12],[p.LINE_OF_SIGHT_TOOL,16],[p.LINE_OF_SIGHT_TOOL_INTERACTIVE,L],[p.VOLUME_MEASUREMENT,4],[p.SNAPPING,L],[p.SHADOW_ACCUMULATOR,30],[p.FLOW_GENERATOR,12],[p.GAUSSIAN_SPLAT_SORTING,2],[p.GAUSSIAN_SPLAT_TEXTURE_ATLAS,12],[p.MAPVIEW_FETCH_QUEUE,L],[p.MAPVIEW_LAYERVIEW_UPDATE,2],[p.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,L]]);function O(e){return f.has(e)?f.get(e):"number"==typeof e?e:1}const S=l(6.5),N=l(1),U=l(30),b=l(1e3/30),P=l(100),k=.9;class C{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=m(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new F,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=d(()=>R.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,T);for(const e of Object.keys(p))this.performanceInfo.tasks.set(p[e],new n(String(p[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new y(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();this._runFrame();const t=this._budget.now();this._recordFrameTaskTimes(t-e);const s=2===this.state?"Idle":1===this.state?"Interacting":"Animating";return a(`${s} Frame Tasks`,e,t,"Maps SDK","Scheduling"),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=S,s=e.frameDuration,r=N;switch(this.state){case 2:t=l(0),s=l(Math.max(P,e.frameDuration)),r=U;break;case 1:s=l(Math.max(b,e.frameDuration))}return s=l(s-e.elapsedFrameTime-t),2!==this.state&&s<N&&!this._forceTask?(this._forceTask=!0,!1):(s=l(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){this._forceTask=!1,this._microTaskQueued=!1,this._run(),this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(l(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*k+e*(1-k)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===L&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==L&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===I&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,p.I3S,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now(),n=i-t;if(a(`${s.name}`,t,i,"Maps SDK","Scheduling"),s.runtime+=n,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+n),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(p))this._frameTaskTimes.set(p[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class y{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new g,this._handles=new s,this._basePriority=O(t),this.schedulePriority=this._basePriority,this._task=m(null!=r?r:this._queue),this._handles.add(c(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(w),this._scheduler.removeTask(this),this.schedule=G.schedule,this.reschedule=G.reschedule,this.scheduleGenerator=G.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=O(e);this._basePriority!==L&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class F{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const w=new F;function D(e){const t=new F;return t.reset(e),t}w.enabled=!1;class M{remove(){}processQueue(){}schedule(e,t,s){try{if(u(t)){const e=_();return s?Promise.resolve(s(e)):Promise.reject(e)}return h(e(w))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(u(t)){const e=_();if(s)return s(e);throw e}const r=e(w);for(;;){const e=r.next(w),i=o(e)?await e:e;if(u(t)){const e=_();if(s){const t=s(e),i=r.return(null);return o(i)&&await E(i),t}const t=r.throw(e);throw o(t)&&await E(t),e}if(i.done)return i.value}}}const G=new M;export{G as ImmediateTask,p as TaskPriority,O as getTaskPriority,D as makeBudget,A as newScheduler,w as noBudget,f as taskPriorities};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import a from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as n,destroyMaybe as p}from"../../core/maybe.js";import{throwIfAborted as l,isAbortError as u}from"../../core/promiseUtils.js";import h from"../../core/ReactiveMap.js";import{on as m,sync as c,watch as d,whenOnce as f}from"../../core/reactiveUtils.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as _}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as b,queryAttachmentsForElements as A}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as E}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as k}from"./expressions/ExpressionsModel.js";import C from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as T}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as V,isFieldInput as j}from"./inputs/support/inputUtils.js";import H from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as L}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as B}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as G,isGroupElementTemplate as R}from"./templates/support/templateUtils.js";function U(e,t){return e?.find(e=>e.layer===t)}let Z=class extends r{constructor(e){super(e),this._attachmentCache=new h,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._activeFormInputsByElementId=new Map,this._emptyForm=new C({inputs:[]}),this._emptyFormTemplate=new H({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new h,this._updatingHandles=new g,this._layerTemplateMap=new h,this._layerContingentValuesMap=new h,this._workingFeatures=new s,this._expressionsManager=new E({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([m(()=>this.features,"after-changes",()=>{this.notifyChange("layers"),this._prepare()},c),d(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),c),d(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),c),d(()=>[this.activeFeature,this.activeLayer,this.activeForm],()=>{this._syncAttachments()},c)]),this._prepare()}destroy(){this._prepareTask=n(this._prepareTask),this._workingFeatures.destroyAll(),p(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new h,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return _(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=_(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(V(e)){const t=e.inputs.find(e=>j(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(j(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await f(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?T(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=n(this._prepareTask),this._updateWorkingFeatures(),p(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new E({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{l(t);const s=new Map;for(const i of e){const e=await L(i);if(l(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(i,new Set(t))}else this._layerContingentValuesMap.set(i,new Set);const r=U(this.layerInfos,i),a=await B(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone},r?.formTemplate);l(t),this._layerTemplateMap.set(i,a);const o=a.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new k({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:o})),!this._hasAsyncArcadeExpressions)for(const t of o.keys()){const e=o.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(G(t))continue;const e=t.clone();R(e)&&(e.elements=e.elements.filter(e=>!G(e)));const{elementId:i}=e;s.has(i)?s.get(i).foldIn(e):s.set(i,e)}}if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");const r=new H({elements:Array.from(s.values())});this.sharedFormTemplate=r,this.sharedForm=T(r,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new h,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&b(t)))return;const i=e.getObjectId();if(null==i)return;const r=this._attachmentCache.get(t);if(r){if(r.get(i))return}const a=[];if(!a.length)return;const n=await A(t,i,a);o(this._attachmentCache,t,()=>new h).set(i,n)}};e([y()],Z.prototype,"_effectiveTimeZone",null),e([y()],Z.prototype,"_attachmentCache",void 0),e([y({readOnly:!0})],Z.prototype,"activeFeature",null),e([y()],Z.prototype,"activeFeatureIndex",void 0),e([y({readOnly:!0})],Z.prototype,"activeForm",null),e([y({readOnly:!0})],Z.prototype,"activeLayer",null),e([y()],Z.prototype,"disabled",void 0),e([y()],Z.prototype,"calculating",null),e([y()],Z.prototype,"editType",void 0),e([y()],Z.prototype,"features",void 0),e([y()],Z.prototype,"expressionEvaluationFailed",null),e([y()],Z.prototype,"hasNonActiveInvalidFeatures",null),e([y()],Z.prototype,"hasAsyncArcadeExpressions",null),e([y()],Z.prototype,"_hasAsyncArcadeExpressions",void 0),e([y()],Z.prototype,"invalidFeatures",null),e([y()],Z.prototype,"hasVisibleInputs",null),e([y()],Z.prototype,"hasLayersWithContingentValues",null),e([y()],Z.prototype,"maximumFeatureCount",void 0),e([y()],Z.prototype,"maximumFeatureCountWithComplexForms",void 0),e([y()],Z.prototype,"visibleInputs",null),e([y()],Z.prototype,"map",void 0),e([y()],Z.prototype,"noVisibleElementsReason",null),e([y()],Z.prototype,"readOnly",void 0),e([y()],Z.prototype,"spatialReference",void 0),e([y()],Z.prototype,"submitHasBeenAttempted",void 0),e([y()],Z.prototype,"timeZone",void 0),e([y()],Z.prototype,"updating",null),e([y()],Z.prototype,"valid",null),e([y()],Z.prototype,"layers",null),e([y()],Z.prototype,"mode",null),e([y()],Z.prototype,"sharedForm",void 0),e([y()],Z.prototype,"sharedFormTemplate",void 0),e([y()],Z.prototype,"userHasChangedValues",void 0),e([y()],Z.prototype,"layerInfos",void 0),e([y()],Z.prototype,"_arcadeExecutorProvider",void 0),e([y()],Z.prototype,"_prepareTask",void 0),e([y()],Z.prototype,"_reactiveGraphicLookup",void 0),e([y()],Z.prototype,"_layerTemplateMap",void 0),e([y()],Z.prototype,"_layerContingentValuesMap",void 0),e([y()],Z.prototype,"_workingFeatures",void 0),e([y()],Z.prototype,"_expressionsManager",void 0),Z=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],Z);const S=Z;export{S as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import a from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as n,destroyMaybe as p}from"../../core/maybe.js";import{throwIfAborted as l,isAbortError as u}from"../../core/promiseUtils.js";import h from"../../core/ReactiveMap.js";import{on as m,sync as c,watch as d,whenOnce as f}from"../../core/reactiveUtils.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as _}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as b,queryAttachmentsForElements as A}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as E}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as k}from"./expressions/ExpressionsModel.js";import C from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as T}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as V,isFieldInput as j}from"./inputs/support/inputUtils.js";import H from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as L}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as B}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as G,isGroupElementTemplate as R,isAttachmentElementTemplate as U}from"./templates/support/templateUtils.js";function Z(e,t){return e?.find(e=>e.layer===t)}let S=class extends r{constructor(e){super(e),this._attachmentCache=new h,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._activeFormInputsByElementId=new Map,this._emptyForm=new C({inputs:[]}),this._emptyFormTemplate=new H({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new h,this._updatingHandles=new g,this._layerTemplateMap=new h,this._layerContingentValuesMap=new h,this._workingFeatures=new s,this._expressionsManager=new E({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([m(()=>this.features,"after-changes",()=>{this.notifyChange("layers"),this._prepare()},c),d(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),c),d(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),c),d(()=>[this.activeFeature,this.activeLayer,this.activeForm],()=>{this._syncAttachments()},c)]),this._prepare()}destroy(){this._prepareTask=n(this._prepareTask),this._workingFeatures.destroyAll(),p(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new h,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return _(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=_(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(V(e)){const t=e.inputs.find(e=>j(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(j(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await f(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?T(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=n(this._prepareTask),this._updateWorkingFeatures(),p(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new E({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{l(t);const s=new Map;for(const i of e){const e=await L(i);if(l(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(i,new Set(t))}else this._layerContingentValuesMap.set(i,new Set);const r=Z(this.layerInfos,i),a=await B(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone},r?.formTemplate);l(t),this._layerTemplateMap.set(i,a);const o=a.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new k({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:o})),!this._hasAsyncArcadeExpressions)for(const t of o.keys()){const e=o.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(G(t))continue;const e=t.clone();R(e)&&(e.elements=e.elements.filter(e=>!G(e)));const{elementId:i}=e;s.has(i)?s.get(i).foldIn(e):s.set(i,e)}}if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");const r=new H({elements:Array.from(s.values())});this.sharedFormTemplate=r,this.sharedForm=T(r,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new h,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&b(t)))return;const i=e.getObjectId();if(null==i)return;const r=this._attachmentCache.get(t);if(r){if(r.get(i))return}const a=s.template?.elements.filter(U)??[];if(!a.length)return;const n=await A(t,i,a);o(this._attachmentCache,t,()=>new h).set(i,n)}};e([y()],S.prototype,"_effectiveTimeZone",null),e([y()],S.prototype,"_attachmentCache",void 0),e([y({readOnly:!0})],S.prototype,"activeFeature",null),e([y()],S.prototype,"activeFeatureIndex",void 0),e([y({readOnly:!0})],S.prototype,"activeForm",null),e([y({readOnly:!0})],S.prototype,"activeLayer",null),e([y()],S.prototype,"disabled",void 0),e([y()],S.prototype,"calculating",null),e([y()],S.prototype,"editType",void 0),e([y()],S.prototype,"features",void 0),e([y()],S.prototype,"expressionEvaluationFailed",null),e([y()],S.prototype,"hasNonActiveInvalidFeatures",null),e([y()],S.prototype,"hasAsyncArcadeExpressions",null),e([y()],S.prototype,"_hasAsyncArcadeExpressions",void 0),e([y()],S.prototype,"invalidFeatures",null),e([y()],S.prototype,"hasVisibleInputs",null),e([y()],S.prototype,"hasLayersWithContingentValues",null),e([y()],S.prototype,"maximumFeatureCount",void 0),e([y()],S.prototype,"maximumFeatureCountWithComplexForms",void 0),e([y()],S.prototype,"visibleInputs",null),e([y()],S.prototype,"map",void 0),e([y()],S.prototype,"noVisibleElementsReason",null),e([y()],S.prototype,"readOnly",void 0),e([y()],S.prototype,"spatialReference",void 0),e([y()],S.prototype,"submitHasBeenAttempted",void 0),e([y()],S.prototype,"timeZone",void 0),e([y()],S.prototype,"updating",null),e([y()],S.prototype,"valid",null),e([y()],S.prototype,"layers",null),e([y()],S.prototype,"mode",null),e([y()],S.prototype,"sharedForm",void 0),e([y()],S.prototype,"sharedFormTemplate",void 0),e([y()],S.prototype,"userHasChangedValues",void 0),e([y()],S.prototype,"layerInfos",void 0),e([y()],S.prototype,"_arcadeExecutorProvider",void 0),e([y()],S.prototype,"_prepareTask",void 0),e([y()],S.prototype,"_reactiveGraphicLookup",void 0),e([y()],S.prototype,"_layerTemplateMap",void 0),e([y()],S.prototype,"_layerContingentValuesMap",void 0),e([y()],S.prototype,"_workingFeatures",void 0),e([y()],S.prototype,"_expressionsManager",void 0),S=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],S);const W=S;export{W as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import t from"../BatchFormInputs.js";import r from"../FieldInput.js";import s from"../GroupInput.js";import n from"../TextElementInput.js";import{
|
|
2
|
+
import e from"../../../../core/Error.js";import t from"../BatchFormInputs.js";import r from"../FieldInput.js";import s from"../GroupInput.js";import n from"../TextElementInput.js";import{isAttachmentElementTemplate as p,isFieldElementTemplate as o,isGroupElementTemplate as m,isTextElementTemplate as a}from"../../templates/support/templateUtils.js";function l(e,r,s){const n=e.elements.filter(e=>!p(e)).map(e=>i(e,r,s));return new t({inputs:n,template:e})}function i(t,p,l){const u=new Set(t.layers),f=p.filter(e=>u.has(e.layer)),c=f.length===p.length;if(o(t))return new r({existsInAllLayers:c,features:f,template:t,expressionsManager:l});if(m(t)){const e=t.elements.map(e=>i(e,p,l));return new s({existsInAllLayers:c,features:f,inputs:e,template:t,expressionsManager:l})}if(a(t))return new n({existsInAllLayers:c,features:f,template:t,expressionsManager:l});throw new e("batch-attribute-form:unsupported-element-template","The type of form element template provided is not supported")}export{l as createBatchFormInputsFromBatchFormTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getEffectiveFieldAlias as r}from"../../../../editing/fieldUtils.js";import n from"../../../../form/ExpressionInfo.js";import{
|
|
2
|
+
import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getEffectiveFieldAlias as r}from"../../../../editing/fieldUtils.js";import n from"../../../../form/ExpressionInfo.js";import{isAttachmentElement as o,isFieldElement as i,isGroupElement as s,isTextElement as a}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as l,isFieldVisibleByDefault as m}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as d,isSubtypeGroupLayer as p}from"../../../../layers/support/layerUtils.js";import{unknown as c}from"../../../../time/constants.js";import{makeExpressionInfosMap as f,makeExecutorSetForFormElement as u}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as x}from"../AttachmentElementTemplate.js";import y from"../BatchFormTemplate.js";import{FieldElementTemplate as w}from"../FieldElementTemplate.js";import{GroupElementTemplate as b}from"../GroupElementTemplate.js";import{TextElementTemplate as E}from"../TextElementTemplate.js";import{compileTextElementMarkdownToHTML as h}from"./textElementTemplateUtils.js";const T="expression/dea57012-47ca4b55a000-8df62742ed0c",v=()=>t.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function I(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?j(r,e,t):F(e,t)}async function F(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(l(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)H(a,e,n)&&i.push(C(a,o));const s=await Promise.all(i);return new y({elements:s,preserveFieldValuesWhenHidden:!0})}function g(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(d(t)||p(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(g(r.elements??[],t))return!0;return!1}async function j(e,t,r){let o=null;g(e.elements??[],t)&&(o=new n({title:"",name:T,expression:"false"}));const i=f(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new y(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const n of a){const e=await L(n,{arcadeExecutorProvider:l,expressionInfos:i,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new y(s)}async function P(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const o=new x({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),i=await u({element:e,expressionInfos:r,provider:t});return o.addLayer(n,i),o}async function L(t,r){return o(t)?P(t,{arcadeExecutorProvider:r.arcadeExecutorProvider,expressionInfos:r.expressionInfos,layer:r.layer}):i(t)?A(t,r):s(t)?Z(t,r):a(t)?U(t,r):(v().warn(new e("batch-attribute-form:unsupported-element-type",`Form elements of type ${t.type} are not supported`)),null)}async function A(t,{arcadeExecutorProvider:r,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:m,hint:c,input:f,label:x}=t;if(null==m||!s.has(m))return v().warn(new e("batch-attribute-form:invalid-form-element-field",`Field element with label '${x}' does not refer to a valid field`)),null;!1!==t.editable||t.editableExpression||((t=t.clone()).editableExpression=T),o.subtypeField&&(d(o)||p(o))&&t.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((t=t.clone()).editableExpression=T);const y=new w({description:a,domain:l,field:s.get(m),hint:c,input:f,formTimeZone:i,layerTimeZone:k(o),label:x}),b=await u({element:t,expressionInfos:n,provider:r});return y.addLayer(o,b),y}async function Z(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await L(p,t);e&&l.push(e)}const m=new b({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await u({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function U(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await h(s):s,d=new E({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await u({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function C(e,{arcadeExecutorProvider:t,layer:n,formTimeZone:o}){const i=r(e,n)||e.name,s=new w({field:e,label:i,formTimeZone:o,layerTimeZone:k(n)}),a={},l=(p(n)||d(n))&&n.subtypeField&&n.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&n.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(n,a),s}function H(e,t,r){return!r.has(e.name.toLowerCase())&&m(e,t)}function k(e){return d(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?c:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{I as createBatchFormTemplate,F as createBatchFormTemplateFromFields};
|