@arcgis/core 5.1.0-next.78 → 5.1.0-next.79
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/analysis/ShadowCast/DiscreteOptions.d.ts +33 -6
- package/analysis/ShadowCast/DiscreteOptions.js +1 -1
- package/analysis/ShadowCast/MinDurationOptions.d.ts +6 -4
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +33 -6
- package/analysis/ShadowCast/TotalDurationOptions.js +1 -1
- package/analysis/ShadowCast/colorStopsUtils.js +2 -0
- package/analysis/ShadowCastAnalysis.d.ts +24 -1
- package/analysis/ShadowCastAnalysis.js +1 -1
- package/analysis/Viewshed.d.ts +27 -0
- package/analysis/Viewshed.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcade/FunctionWrapper.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/debug.d.ts +139 -0
- package/arcade/debug.js +2 -0
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.d.ts +46 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1c7183551f5269bdcf13.js → 01bd1b86ba899c6aa4c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8ccf96069ac3a40c3d.js → 01ee18782a50279f907e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f81c6f6ccc201f584970.js → 022067e807905cabeaa1.js} +1 -1
- package/assets/esri/core/workers/chunks/{11ea4be441a26134ce1f.js → 052cdc7aaa803b5873f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7bb7072dbee978f3ca3.js → 056fd7847caaff2c9514.js} +1 -1
- package/assets/esri/core/workers/chunks/{8acee3fba488f202f82f.js → 05c3146d87d917606193.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8ca5d8740cc7e39197b.js → 0aebcbf41cb193e76809.js} +5 -5
- package/assets/esri/core/workers/chunks/{54023458195549f66215.js → 0b77c124b743067e4155.js} +1 -1
- package/assets/esri/core/workers/chunks/10408183681fd6c7b4ed.js +2 -0
- package/assets/esri/core/workers/chunks/{7595ceba529ed01c7590.js → 2c87c3112a43db8624f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{13e60f19f436b8d683ae.js → 3c9482764c9e4f8bcbb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{322c54081b25f1c53661.js → 3e37019eee1c49d2bf64.js} +1 -1
- package/assets/esri/core/workers/chunks/45c83eb7c2a06166e3b0.js +1 -0
- package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +1 -0
- package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +2 -0
- package/assets/esri/core/workers/chunks/{34fe97bcacc0dfc5bce6.js → 5ccc325d83cec4f5ccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{30e710ec4d22c43d4e7e.js → 5cffc7b49966201eccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a87e9bbd85ba29b1514.js → 5da2051f548c2942e01a.js} +1 -1
- package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +2 -0
- package/assets/esri/core/workers/chunks/{0b1454a77a6a682541dc.js.LICENSE.txt → 5ec66e39e53c11e75179.js.LICENSE.txt} +9 -1
- package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +1 -0
- package/assets/esri/core/workers/chunks/{abc06d10c7ac8ba5b0e4.js → 67ec1694d6e18b7c234c.js} +1 -1
- package/assets/esri/core/workers/chunks/{32e22d6eee9fed1f70b0.js → 6d696beddcc5fbed5875.js} +1 -1
- package/assets/esri/core/workers/chunks/{f590b60fca607d66001a.js → 716a4d7e8b908b81870b.js} +1 -1
- package/assets/esri/core/workers/chunks/71fe127734f33d020a44.js +1 -0
- package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +2 -0
- package/assets/esri/core/workers/chunks/7cea68257d24ffd205bb.js +1 -0
- package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +1 -0
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +596 -0
- package/assets/esri/core/workers/chunks/{d950d5c2844206502ff0.js → 992cd87ba0ab6346f692.js} +1 -1
- package/assets/esri/core/workers/chunks/{73c87eb9bd8f0f848481.js → 9c11e1fe785e1385fdb1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ed8d8b5336c81fbcda3.js → 9d216e30d04ea21fc8a2.js} +1 -1
- package/assets/esri/core/workers/chunks/a54aa93b6012a2597f82.js +1 -0
- package/assets/esri/core/workers/chunks/{cf14b3a44705dacefac4.js → a9b5ce00323cd5574bf7.js} +1 -1
- package/assets/esri/core/workers/chunks/ae6b3dfe5f757df539d6.js +1 -0
- package/assets/esri/core/workers/chunks/b14c4c3f295970f731ab.js +1 -0
- package/assets/esri/core/workers/chunks/{c70df6ed190f9ebcf6aa.js → bf2c202dec5ab7bc770b.js} +1 -1
- package/assets/esri/core/workers/chunks/c1d4110aa494a1dba3c4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d8c7cc7f8decbe975d.js → c442916805975744dd92.js} +1 -1
- package/assets/esri/core/workers/chunks/dacc2e5fa462495ed1cc.js +2 -0
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +1 -0
- package/assets/esri/core/workers/chunks/{dda2cb5c073d1e65f14f.js → f43d628d47eec7d530c7.js} +1 -1
- package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +1 -0
- package/assets/esri/core/workers/chunks/{4ccb56333de0247dcb6f.js → fb100935fd8948d779f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ee4b630ad39c21d11db.js → fb9e3e7cd532ac4353f1.js} +12 -12
- package/assets/esri/core/workers/chunks/fc6ca7ffb9f1b875059c.js +1 -0
- package/assets/esri/core/workers/chunks/{3d9fcbe95dd22dbe730e.js → ffc4f3406ce383b9bd88.js} +1 -1
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -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/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
- package/chunks/ImageMaterial.glsl.js +7 -5
- package/chunks/SlicePlaneMaterial.glsl.js +21 -13
- package/chunks/arcade.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +18 -14
- package/layers/SceneLayer.d.ts +35 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/scene/ModelFileInfo.d.ts +29 -0
- package/layers/scene/ModelFileInfo.js +2 -0
- package/layers/scene/ModelInfo.d.ts +38 -0
- package/layers/scene/ModelInfo.js +2 -0
- package/layers/scene/modelQuerySupport.js +2 -0
- package/layers/scene/types.d.ts +14 -0
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/types.d.ts +13 -1
- package/package.json +3 -3
- package/popup/Features.d.ts +1 -6
- package/popup/Features.js +1 -1
- package/popup/actions.js +1 -1
- package/renderers/visualVariables/support/ColorStop.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueProgramCache.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/EntityStorage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MosaicInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerLUTShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/lut.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/BaseRasterProcessorShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ColormapToRGBShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ConvolutionShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/FocalStatisticsShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/HillshadeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vvUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/StencilGeometry.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/focusAreaUtils.js +2 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/focusAreaMaskUtils.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Compositor.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +54 -0
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -3
- package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +21 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion.d.ts +21 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/07eff82916681fcff069.js +0 -1
- package/assets/esri/core/workers/chunks/0b1454a77a6a682541dc.js +0 -2
- package/assets/esri/core/workers/chunks/1c7fd0a229a8112b0539.js +0 -596
- package/assets/esri/core/workers/chunks/3697e51e1e4cf442f39a.js +0 -1
- package/assets/esri/core/workers/chunks/3cce9dad8ee0e4971d50.js +0 -1
- package/assets/esri/core/workers/chunks/3df8493b91aa3bce824d.js +0 -1
- package/assets/esri/core/workers/chunks/68a313155ddc29bd024d.js +0 -1
- package/assets/esri/core/workers/chunks/751609831b283903ba48.js +0 -1
- package/assets/esri/core/workers/chunks/7bacdd65a6cc4d284e0a.js +0 -2
- package/assets/esri/core/workers/chunks/7e97684e851274efd11f.js +0 -1
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +0 -1
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +0 -1
- package/assets/esri/core/workers/chunks/9aaf78b831f8739bc127.js +0 -1
- package/assets/esri/core/workers/chunks/9b9916864b6575c42c8a.js +0 -1
- package/assets/esri/core/workers/chunks/bf7e019437a3b6036300.js +0 -2
- package/assets/esri/core/workers/chunks/d304343a781acfa3ff96.js +0 -1
- package/assets/esri/core/workers/chunks/dbb9bb28696ff9536678.js +0 -2
- package/assets/esri/core/workers/chunks/f09a41ad239d467d9438.js +0 -2
- package/assets/esri/core/workers/chunks/f6912532aae1638cbe8f.js +0 -1
- /package/assets/esri/core/workers/chunks/{7bacdd65a6cc4d284e0a.js.LICENSE.txt → 10408183681fd6c7b4ed.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f09a41ad239d467d9438.js.LICENSE.txt → 5818f1f526577068d6ca.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{dbb9bb28696ff9536678.js.LICENSE.txt → 7cdd0492b2191df95102.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bf7e019437a3b6036300.js.LICENSE.txt → dacc2e5fa462495ed1cc.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 e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,syncAndInitial as f}from"../../core/reactiveUtils.js";import{throttle as y}from"../../core/throttle.js";import{property as T,subclass as w}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as C}from"../../editing/fieldUtils.js";import{geometryTypes as I}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as v}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as _,isSubtypeGroupLayer as E}from"../../layers/support/layerUtils.js";import{createFieldInfos as S}from"../../support/popupUtils.js";import A from"../../tables/AttributeTableTemplate.js";import F from"../../tables/support/FieldOrder.js";import j from"../../time/TimeExtent.js";import x from"../../views/SelectionManager.js";import{temporaryHighlightName as R}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as O}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as U,isSelectableLayer as P}from"../../views/support/selectionUtils.js";import V from"./ActionColumn.js";import z from"./AttachmentsColumn.js";import W from"./FieldColumn.js";import H from"./RelationshipColumn.js";import B from"./Grid/Column.js";import M from"./Grid/Grid.js";import L from"./Grid/GridViewModel.js";import G from"./Grid/GroupColumn.js";import k from"./support/AttachmentsColumnTemplate.js";import N from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as D,isFieldColumn as $,isRelationshipColumn as Z}from"./support/columnUtils.js";import{downloadAttachmentInfo as q,exportToCSV as Q}from"./support/exportUtils.js";import K from"./support/FeatureStore.js";import J from"./support/FieldColumnTemplate.js";import X from"./support/RelationshipColumnTemplate.js";import Y from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as ee,isIFeatureTableSupportedLayerWithRelationships as te,findRelatedLayerInSources as ie,findRelationship as se,uniqueColumnNames as ne,hasColumnForField as le,findField as re,isIFeatureTableSupportedLayerWithAttachments as oe,getRelationshipIdsToShow as ae}from"./support/tableUtils.js";import{createAttributeTableElements as de}from"./support/templateUtils.js";import{goTo as he}from"../support/goToUtils.js";import{messageBundle as me}from"../support/widget.js";const ce="80px";let pe=class extends L{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=y(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new N,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new x,this.grid=null,this.highlightEnabled=!0,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new K),this._set("grid",new M({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),u(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,()=>this.refreshCellContent()),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),u(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),b(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,m(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))}),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),f),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),f),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),f),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return v(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return O(e)?e:null}get _subtypes(){return _(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>D(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&U(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>$(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return ee(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>Z(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,n=this.store.relationshipInfos;if(n.length||!te(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=ie(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",e)}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this.store.timeZone}set timeZone(e){this.store.timeZone=e}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=se(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(ne.action)||d.add(ne.action),d.includes(ne.attachments)||d.add(ne.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([ne.action,ne.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await Q({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(ne.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(ne.action)||i.add(ne.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&P(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const n=await e.queryFeatures(s);try{await he(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=de(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new F({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new F({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&E(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>D(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>Z(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=S(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||le(t.fieldName,r))return null;const{fieldName:i}=t,n=re(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&oe(e)&&!r.some(e=>D(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&te(e)&&e.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!r.some(t=>Z(t)&&t.relationshipId===e)&&r.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),r.length?r:null}_generateColumnsFromAttributeTableElements(e,t,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=re(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new W({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new G({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new z({description:n,fieldName:`${ne.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new H({description:s,fieldName:`${ne.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,formatFunction:g,frozen:b,frozenToEnd:f,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,resizable:E,sortable:S,textAlign:A,textWrap:F,timeZone:j,type:x,width:R}=t;if(!x)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(b&&f)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const O=!1===t.visible;if("group"===x){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=O||this._isFieldHidden(t.label);a.push(new G({autoWidth:h,columns:r,description:m,flexGrow:p,frozen:b,frozenToEnd:f,grid:i,hidden:o,icon:y,iconText:T,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,textAlign:A,textWrap:F,timeZone:j,width:R}))}else if("attachment"===x){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,t,d))}else if("relationship"===x){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const U=O||this._isFieldHidden(u);if("column"===x)a.push(new B({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,sortable:S,store:r,textAlign:A,textWrap:F,timeZone:j,width:R}));else if("field"===x){const d=re(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:x}=t;a.push(new W({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:_,required:x,resizable:E,sortable:S,store:r,template:t,textAlign:A,textWrap:F,timeZone:j,width:R,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new W({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,resizable:I,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x}=t;return new z({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${ne.attachments}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,layer:e,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:I,store:o,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=ne.attachments;return new z({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new H({autoWidth:a,collapsed:d,description:h,fieldName:`${ne.relationship}-${I}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new H({...t,fieldName:`${ne.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new V({hidden:this._isFieldHidden(ne.action),store:this.store,...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:R})})}_syncSelection(){const{layer:e}=this;U(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;U(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;U(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(t),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(ne.action)||s.add(ne.action),s.includes(ne.attachments)||s.add(ne.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:ae(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([ne.action,ne.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new Y({columnTemplates:[new J({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new X({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:ce})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new J({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new k({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ce})),new Y({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:r.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new Y({columnTemplates:[new J({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new k({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ce})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&C(s,i)]}):i?.fields.map(e=>[e.name,C(e,i)])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?a.getLogger(this).warnOnce(e):a.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([T()],pe.prototype,"_defaultHiddenFields",null),e([T()],pe.prototype,"_effectiveTableTemplate",null),e([T()],pe.prototype,"_effectiveAttributeTableTemplate",null),e([T()],pe.prototype,"_highlightableLayerView",null),e([T()],pe.prototype,"_subtypes",null),e([T()],pe.prototype,"activeFilters",null),e([T({readOnly:!0})],pe.prototype,"activeSortOrders",null),e([T()],pe.prototype,"allRelatedTablesVisible",null),e([T()],pe.prototype,"attachmentsColumns",null),e([T()],pe.prototype,"attachmentsEnabled",null),e([T()],pe.prototype,"attachmentsViewOptions",void 0),e([T({type:A})],pe.prototype,"attributeTableTemplate",void 0),e([T()],pe.prototype,"autoRefreshEnabled",void 0),e([T()],pe.prototype,"autoSaveEnabled",null),e([T()],pe.prototype,"canAddRelatedFeature",null),e([T()],pe.prototype,"clearPrompt",null),e([T({readOnly:!0})],pe.prototype,"columns",void 0),e([T()],pe.prototype,"dataProvider",void 0),e([T()],pe.prototype,"defaultSelectionManager",void 0),e([T()],pe.prototype,"definitionExpression",null),e([T()],pe.prototype,"effectiveSelectionManager",null),e([T()],pe.prototype,"fieldColumns",null),e([T()],pe.prototype,"filterByViewExtent",null),e([T({types:I})],pe.prototype,"filterGeometry",null),e([T()],pe.prototype,"filterBySelectionEnabled",null),e([T({readOnly:!0})],pe.prototype,"grid",void 0),e([T()],pe.prototype,"hasContingentValues",null),e([T()],pe.prototype,"hasInvalidPendingEdits",null),e([T()],pe.prototype,"hasPendingEdits",null),e([T()],pe.prototype,"hiddenFields",null),e([T()],pe.prototype,"highlightEnabled",void 0),e([T()],pe.prototype,"initialSize",null),e([T()],pe.prototype,"isQueryingOrSyncing",null),e([T()],pe.prototype,"isSyncingAttachments",null),e([T()],pe.prototype,"layer",null),e([T()],pe.prototype,"layers",void 0),e([T()],pe.prototype,"layerFieldConfigurations",null),e([T()],pe.prototype,"layerView",null),e([T()],pe.prototype,"menuConfig",void 0),e([T()],pe.prototype,"messages",void 0),e([T(),me("esri/t9n/common")],pe.prototype,"messagesCommon",void 0),e([T(),me("esri/core/t9n/Units")],pe.prototype,"messagesUnits",void 0),e([T(),me("esri/widgets/support/t9n/uriUtils")],pe.prototype,"messagesURIUtils",void 0),e([T()],pe.prototype,"outFields",null),e([T()],pe.prototype,"pendingEditsCount",null),e([T()],pe.prototype,"prompt",void 0),e([T()],pe.prototype,"relatedRecordsEnabled",null),e([T()],pe.prototype,"relatedTable",null),e([T()],pe.prototype,"relatedTableHasContingentValues",null),e([T()],pe.prototype,"relatedTables",void 0),e([T()],pe.prototype,"relationship",null),e([T()],pe.prototype,"relationshipColumnConfigs",void 0),e([T()],pe.prototype,"relationshipColumns",null),e([T()],pe.prototype,"relationshipConfig",null),e([T()],pe.prototype,"relationshipInfos",null),e([T()],pe.prototype,"relationships",null),e([T()],pe.prototype,"returnGeometryEnabled",null),e([T()],pe.prototype,"returnMEnabled",null),e([T()],pe.prototype,"returnZEnabled",null),e([T()],pe.prototype,"selectionManager",void 0),e([T()],pe.prototype,"selectionSource",null),e([T()],pe.prototype,"showAllRelatedTables",null),e([T()],pe.prototype,"showPrompt",null),e([T()],pe.prototype,"showRelatedTableCallback",void 0),e([T({readOnly:!0,type:K})],pe.prototype,"store",void 0),e([T()],pe.prototype,"supportsAttachments",null),e([T()],pe.prototype,"supportsAddAttachments",null),e([T()],pe.prototype,"supportsDeleteAttachments",null),e([T()],pe.prototype,"supportsResizeAttachments",null),e([T()],pe.prototype,"supportsUpdateAttachments",null),e([T()],pe.prototype,"syncTemplateOnChangesEnabled",void 0),e([T()],pe.prototype,"syncViewSelection",void 0),e([T()],pe.prototype,"tableController",void 0),e([T()],pe.prototype,"tableParent",void 0),e([T({type:Y})],pe.prototype,"tableTemplate",void 0),e([T()],pe.prototype,"tableTemplateOverride",void 0),e([T({type:j})],pe.prototype,"timeExtent",null),e([T()],pe.prototype,"timeZone",null),e([T()],pe.prototype,"view",null),pe=e([w("esri.widgets.FeatureTable.FeatureTableViewModel")],pe);const ue=pe;export{ue as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,sync as f,syncAndInitial as y}from"../../core/reactiveUtils.js";import{throttle as T}from"../../core/throttle.js";import{property as w,subclass as C}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as I}from"../../editing/fieldUtils.js";import{geometryTypes as v}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as _}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as E,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as A}from"../../support/popupUtils.js";import F from"../../tables/AttributeTableTemplate.js";import j from"../../tables/support/FieldOrder.js";import x from"../../time/TimeExtent.js";import R from"../../views/SelectionManager.js";import{temporaryHighlightName as O}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as U}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as P,isSelectableLayer as V}from"../../views/support/selectionUtils.js";import z from"./ActionColumn.js";import W from"./AttachmentsColumn.js";import H from"./FieldColumn.js";import B from"./RelationshipColumn.js";import M from"./Grid/Column.js";import L from"./Grid/Grid.js";import G from"./Grid/GridViewModel.js";import k from"./Grid/GroupColumn.js";import N from"./support/AttachmentsColumnTemplate.js";import D from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as Z,isRelationshipColumn as q}from"./support/columnUtils.js";import{downloadAttachmentInfo as Q,exportToCSV as K}from"./support/exportUtils.js";import J from"./support/FeatureStore.js";import X from"./support/FieldColumnTemplate.js";import Y from"./support/RelationshipColumnTemplate.js";import ee from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as te,isIFeatureTableSupportedLayerWithRelationships as ie,findRelatedLayerInSources as se,findRelationship as ne,uniqueColumnNames as le,hasColumnForField as re,findField as oe,isIFeatureTableSupportedLayerWithAttachments as ae,getRelationshipIdsToShow as de}from"./support/tableUtils.js";import{createAttributeTableElements as he}from"./support/templateUtils.js";import{goTo as me}from"../support/goToUtils.js";import{messageBundle as ce}from"../support/widget.js";const pe="80px";let ue=class extends G{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=T(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new D,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new R,this.grid=null,this.highlightEnabled=!0,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new J),this._set("grid",new L({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),u(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,()=>this.refreshCellContent()),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),u(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),b(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;const t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},f),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),y),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),y),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return _(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return U(e)?e:null}get _subtypes(){return E(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>$(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&P(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>Z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return te(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>q(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,n=this.store.relationshipInfos;if(n.length||!ie(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=se(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",e)}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this.store.timeZone}set timeZone(e){this.store.timeZone=e}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=ne(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(le.action)||d.add(le.action),d.includes(le.attachments)||d.add(le.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await Q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([le.action,le.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await K({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(le.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(le.action)||i.add(le.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&V(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const n=await e.queryFeatures(s);try{await me(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=he(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new j({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new j({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&S(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>q(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=A(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||re(t.fieldName,r))return null;const{fieldName:i}=t,n=oe(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&ae(e)&&!r.some(e=>$(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&ie(e)&&e.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!r.some(t=>q(t)&&t.relationshipId===e)&&r.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),r.length?r:null}_generateColumnsFromAttributeTableElements(e,t,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=oe(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new H({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new k({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new W({description:n,fieldName:`${le.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new B({description:s,fieldName:`${le.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,formatFunction:g,frozen:b,frozenToEnd:f,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,resizable:E,sortable:S,textAlign:A,textWrap:F,timeZone:j,type:x,width:R}=t;if(!x)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(b&&f)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const O=!1===t.visible;if("group"===x){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=O||this._isFieldHidden(t.label);a.push(new k({autoWidth:h,columns:r,description:m,flexGrow:p,frozen:b,frozenToEnd:f,grid:i,hidden:o,icon:y,iconText:T,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,textAlign:A,textWrap:F,timeZone:j,width:R}))}else if("attachment"===x){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,t,d))}else if("relationship"===x){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const U=O||this._isFieldHidden(u);if("column"===x)a.push(new M({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,sortable:S,store:r,textAlign:A,textWrap:F,timeZone:j,width:R}));else if("field"===x){const d=oe(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:x}=t;a.push(new H({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:_,required:x,resizable:E,sortable:S,store:r,template:t,textAlign:A,textWrap:F,timeZone:j,width:R,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new H({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,resizable:I,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x}=t;return new W({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${le.attachments}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,layer:e,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:I,store:o,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=le.attachments;return new W({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new B({autoWidth:a,collapsed:d,description:h,fieldName:`${le.relationship}-${I}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new B({...t,fieldName:`${le.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new z({hidden:this._isFieldHidden(le.action),store:this.store,...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:O})})}_syncSelection(){const{layer:e}=this;P(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(t),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(le.action)||s.add(le.action),s.includes(le.attachments)||s.add(le.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:de(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([le.action,le.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new ee({columnTemplates:[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new Y({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:pe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})),new ee({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:r.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new ee({columnTemplates:[new X({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&I(s,i)]}):i?.fields.map(e=>[e.name,I(e,i)])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?a.getLogger(this).warnOnce(e):a.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([w()],ue.prototype,"_defaultHiddenFields",null),e([w()],ue.prototype,"_effectiveTableTemplate",null),e([w()],ue.prototype,"_effectiveAttributeTableTemplate",null),e([w()],ue.prototype,"_highlightableLayerView",null),e([w()],ue.prototype,"_subtypes",null),e([w()],ue.prototype,"activeFilters",null),e([w({readOnly:!0})],ue.prototype,"activeSortOrders",null),e([w()],ue.prototype,"allRelatedTablesVisible",null),e([w()],ue.prototype,"attachmentsColumns",null),e([w()],ue.prototype,"attachmentsEnabled",null),e([w()],ue.prototype,"attachmentsViewOptions",void 0),e([w({type:F})],ue.prototype,"attributeTableTemplate",void 0),e([w()],ue.prototype,"autoRefreshEnabled",void 0),e([w()],ue.prototype,"autoSaveEnabled",null),e([w()],ue.prototype,"canAddRelatedFeature",null),e([w()],ue.prototype,"clearPrompt",null),e([w({readOnly:!0})],ue.prototype,"columns",void 0),e([w()],ue.prototype,"dataProvider",void 0),e([w()],ue.prototype,"defaultSelectionManager",void 0),e([w()],ue.prototype,"definitionExpression",null),e([w()],ue.prototype,"effectiveSelectionManager",null),e([w()],ue.prototype,"fieldColumns",null),e([w()],ue.prototype,"filterByViewExtent",null),e([w({types:v})],ue.prototype,"filterGeometry",null),e([w()],ue.prototype,"filterBySelectionEnabled",null),e([w({readOnly:!0})],ue.prototype,"grid",void 0),e([w()],ue.prototype,"hasContingentValues",null),e([w()],ue.prototype,"hasInvalidPendingEdits",null),e([w()],ue.prototype,"hasPendingEdits",null),e([w()],ue.prototype,"hiddenFields",null),e([w()],ue.prototype,"highlightEnabled",void 0),e([w()],ue.prototype,"initialSize",null),e([w()],ue.prototype,"isQueryingOrSyncing",null),e([w()],ue.prototype,"isSyncingAttachments",null),e([w()],ue.prototype,"layer",null),e([w()],ue.prototype,"layers",void 0),e([w()],ue.prototype,"layerFieldConfigurations",null),e([w()],ue.prototype,"layerView",null),e([w()],ue.prototype,"menuConfig",void 0),e([w()],ue.prototype,"messages",void 0),e([w(),ce("esri/t9n/common")],ue.prototype,"messagesCommon",void 0),e([w(),ce("esri/core/t9n/Units")],ue.prototype,"messagesUnits",void 0),e([w(),ce("esri/widgets/support/t9n/uriUtils")],ue.prototype,"messagesURIUtils",void 0),e([w()],ue.prototype,"outFields",null),e([w()],ue.prototype,"pendingEditsCount",null),e([w()],ue.prototype,"prompt",void 0),e([w()],ue.prototype,"relatedRecordsEnabled",null),e([w()],ue.prototype,"relatedTable",null),e([w()],ue.prototype,"relatedTableHasContingentValues",null),e([w()],ue.prototype,"relatedTables",void 0),e([w()],ue.prototype,"relationship",null),e([w()],ue.prototype,"relationshipColumnConfigs",void 0),e([w()],ue.prototype,"relationshipColumns",null),e([w()],ue.prototype,"relationshipConfig",null),e([w()],ue.prototype,"relationshipInfos",null),e([w()],ue.prototype,"relationships",null),e([w()],ue.prototype,"returnGeometryEnabled",null),e([w()],ue.prototype,"returnMEnabled",null),e([w()],ue.prototype,"returnZEnabled",null),e([w()],ue.prototype,"selectionManager",void 0),e([w()],ue.prototype,"selectionSource",null),e([w()],ue.prototype,"showAllRelatedTables",null),e([w()],ue.prototype,"showPrompt",null),e([w()],ue.prototype,"showRelatedTableCallback",void 0),e([w({readOnly:!0,type:J})],ue.prototype,"store",void 0),e([w()],ue.prototype,"supportsAttachments",null),e([w()],ue.prototype,"supportsAddAttachments",null),e([w()],ue.prototype,"supportsDeleteAttachments",null),e([w()],ue.prototype,"supportsResizeAttachments",null),e([w()],ue.prototype,"supportsUpdateAttachments",null),e([w()],ue.prototype,"syncTemplateOnChangesEnabled",void 0),e([w()],ue.prototype,"syncViewSelection",void 0),e([w()],ue.prototype,"tableController",void 0),e([w()],ue.prototype,"tableParent",void 0),e([w({type:ee})],ue.prototype,"tableTemplate",void 0),e([w()],ue.prototype,"tableTemplateOverride",void 0),e([w({type:x})],ue.prototype,"timeExtent",null),e([w()],ue.prototype,"timeZone",null),e([w()],ue.prototype,"view",null),ue=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],ue);const ge=ue;export{ge as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{drainHandles as l,disposable as h,makeHandle as c,destroyHandle as d}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as y,abortMaybe as m}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as G,whenOnce as T}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as A}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as E,isLoaded as M,load as k,project as H}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as I}from"../../geometry/support/coordsUtils.js";import{equals as P}from"../../geometry/support/spatialReferenceUtils.js";import D from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as j}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as U}from"../../support/elevationInfoUtils.js";import R from"../../symbols/CIMSymbol.js";import x from"../../symbols/FillSymbol3DLayer.js";import L from"../../symbols/MeshSymbol3D.js";import F from"../../symbols/SimpleFillSymbol.js";import V from"../../symbols/SimpleLineSymbol.js";import W from"../../symbols/SimpleMarkerSymbol.js";import K from"../../symbols/TextSymbol.js";import{symbolTypes as Z}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as q}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as N}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as z}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as B}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as $}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Y}from"../../views/input/InputManager.js";import{sketchKeys as X}from"../../views/interactive/keybindings.js";import J from"../../views/interactive/sketch/SketchLabelOptions.js";import Q from"../../views/interactive/sketch/SketchOptions.js";import ee from"../../views/interactive/sketch/SketchTooltipOptions.js";import te from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as oe}from"../../views/interactive/snapping/SnappingManager.js";import ie from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as ae}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as re}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as se}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ne}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as pe}from"../../views/support/screenUtils.js";import le from"./adapters/layer/GraphicsLayerAdapter.js";import he from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ce,DrawToolOperationHandle as de,UpdateOperationHandle as ue}from"./support/OperationHandle.js";import{PluginManager as ye}from"./support/PluginManager.js";import{SettingsManager as me}from"./support/SettingsManager.js";import{getLegacyTool as ge,isCompletelyDegenerate as ve,graphicsHaveTooFewVerticesForBox as fe,getModeFromCreateOptions as _e,getDrawToolGeometryTypeFromCreateTool as be}from"./support/sketchUtils.js";const we={defaultZ:0},Ge={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:se},tool:"transform"},Te=Symbol(),Oe=Symbol();let Se=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new D({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ye({sketchViewModel:this}),this.settingsManager=new me({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new C,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new re,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new F({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new V({color:[130,130,130,1],width:2}),this.meshSymbol=new L({symbolLayers:new s([new x])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Q,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Oe),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Oe)},this._originalPopupEnabled=null,this.defaultCreateOptions=we,this.defaultUpdateOptions=Ge,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new ie,this.textSymbol=new K({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=y(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new oe({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),ae(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=y(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new le(e);case"map-notes":return new he(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...we,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Ge,...e,reshapeOptions:{...Ge.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Ge.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=y(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new oe({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(G(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=m(this._moduleLoaderAbortController),this._viewReadyAbortController=m(this._viewReadyAbortController),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");$(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=ge(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||je(s)||($(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||P(o.geometry.spatialReference,t.spatialReference)||(E(o.geometry.spatialReference,t.spatialReference)||M()||await k(),o.geometry=H(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ne(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{j(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?A(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Y.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(pe(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=ge(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=_e(p,e),c=be(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,y={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(y):this._makeDrawGraphicTool3D(y)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Ee(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=[o.on("key-down",t=>{if(t.key===X.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===X.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==X.vertexAdd||t.repeat)t.key===X.undo?(t.stopPropagation(),n.undo()):t.key===X.redo?(t.stopPropagation(),n.redo()):t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===X.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Y.WIDGET),o.on("key-up",t=>{t.key===X.pan?e.enabled=!0:t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===X.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Y.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?n&&n.cancel():n&&n.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],n=new ce({activeComponent:e,type:"create",onEnd:()=>{l(s),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===X.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},Y.WIDGET),a.on("key-up",e=>{e.key===X.pan&&(o.editable=!0)},Y.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===X.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||ve(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,h(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new de({activeComponent:o,type:"create",onEnd:()=>{l(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return c();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),c(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new R({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Ge.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return fe(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,h=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const l of e){const e=new s({view:o,graphic:l}),t=N(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${q(t)}).`),null;p.set(l,e)}const c=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),c.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const d=[],u=new ue({activeComponent:c,tool:i,type:"update",onEnd:()=>{l(d),De(o,c),h()},undo:()=>{Ie(this.view,c),Me(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),c.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(c.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!je(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Y.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===B(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:h}=n.module,c=new h({graphic:e,view:o}),d=new p({object:c,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],y=new ue({activeComponent:d,tool:i,type:"update",onEnd:()=>{l(u),De(o,d),c.destroy()},undo:()=>{Ie(this.view,d),Me(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},Y.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(h))return h;const{ManipulatedObject3DGraphic:c,ExtentTransformTool:d}=h.module,u=this.view?.inputManager?.isModifierKeyDown(X.constraint),y=new c({view:o,graphic:e}),m=new d({object:y,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new ue({activeComponent:m,tool:a,type:"update",onEnd:()=>{l(g),De(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!je(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Y.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Y.WIDGET),o.on("key-down",e=>{e.key!==X.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Y.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(je(a))return a;const r=new ue({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),l(p),l(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();Me(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ke(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==X.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),h=z(p);if(0!==h)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${q(h)}).`),null;const c=t.reshapeOptions,d=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===c?.vertexOperation,enableZShape:t.enableZ&&"move"===c?.shapeOperation,enableMoveObject:"move"===c?.shapeOperation||"move-xy"===c?.shapeOperation,enableMidpoints:"split"===c?.edgeOperation,enableEdgeOffset:"offset"===c?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(p.graphic);const u=[],y=new ue({activeComponent:d,tool:a,type:"update",onEnd:()=>{l(u),De(o,d),p.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));je(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},Y.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(je(a))return a;const r=new ue({activeComponent:a,type:"update",onEnd:()=>{l(n),l(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{Me(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ke(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(je(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():fe(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),je(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(l(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Y.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===X.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET),i.on("key-up",e=>{if(e.key===X.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return je(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(je(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(X.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return je(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>I(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>I(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Pe(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Pe(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Pe(t.graphics))),o.on("scale-start",t=>e.addToHistory(Pe(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Pe([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Pe([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Pe([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Pe([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=pe(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===X.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===X.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===X.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&X.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=y(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Te)}_displayCursor(e){this.removeHandles(Te),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Te)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??U("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(d(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return T(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(m(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(T(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Ae("view"))}_logMissingLayer(){this._logError(Ce,Ae("layer"))}};o([O()],Se.prototype,"_defaultSnappingManager",void 0),o([O()],Se.prototype,"_layerAdapter",null),o([O()],Se.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Se.prototype,"settingsManager",void 0),o([O()],Se.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Se.prototype,"_updatingHandles",void 0),o([O()],Se.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Se.prototype,"activeTool",null),o([O()],Se.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Se.prototype,"activeCreateToolDrawMode",null),o([O()],Se.prototype,"activeTooltip",null),o([O({types:Z})],Se.prototype,"activeFillSymbol",void 0),o([O()],Se.prototype,"activeLineSymbol",void 0),o([O()],Se.prototype,"activeVertexSymbol",void 0),o([O()],Se.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Se.prototype,"createGraphic",null),o([O()],Se.prototype,"defaultCreateOptions",null),o([O()],Se.prototype,"defaultUpdateOptions",null),o([O()],Se.prototype,"activeUpdateOptions",void 0),o([O({type:J,nonNullable:!0})],Se.prototype,"labelOptions",null),o([O()],Se.prototype,"layer",void 0),o([O({types:Z})],Se.prototype,"pointSymbol",void 0),o([O({types:Z})],Se.prototype,"polygonSymbol",void 0),o([O({types:Z})],Se.prototype,"polylineSymbol",void 0),o([O()],Se.prototype,"meshSymbol",void 0),o([O({type:K})],Se.prototype,"textSymbol",null),o([O({type:ie,nonNullable:!0})],Se.prototype,"snappingOptions",null),o([O()],Se.prototype,"snappingManager",null),o([O({readOnly:!0})],Se.prototype,"state",null),o([O({type:ee,nonNullable:!0})],Se.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Se.prototype,"updateGraphics",void 0),o([O()],Se.prototype,"updateOnGraphicClick",void 0),o([O()],Se.prototype,"updating",null),o([O()],Se.prototype,"creationMode",void 0),o([O({type:te,nonNullable:!0})],Se.prototype,"valueOptions",null),o([O({types:Z})],Se.prototype,"vertexSymbol",void 0),o([O({value:null})],Se.prototype,"view",null),o([O({constructOnly:!0,type:Q})],Se.prototype,"sketchOptions",void 0),o([O()],Se.prototype,"useLegacyCreateTools",void 0),o([O()],Se.prototype,"isUsingLegacyCreateTools",null),o([O()],Se.prototype,"pluginManager",null),o([O()],Se.prototype,"drawTool",null),o([O()],Se.prototype,"rootPlugins",null),o([O()],Se.prototype,"effectiveAvailablePlugins",null),o([O()],Se.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Se.prototype,"multiplePluginsActive",null),Se=o([S("esri.widgets.Sketch.SketchViewModel")],Se);const Ce="sketch:missing-property",Ae=e=>`Property '${e}' is missing on SketchViewModel.`;function Ee(e){return"polygon"===e||"rectangle"===e||"circle"===e}function Me(e,t){He("undo",e.history.undo,e.history.redo,t)}function ke(e,t){He("redo",e.history.redo,e.history.undo,t)}function He(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function Ie(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Pe(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function De(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function je(e){return"requireError"in e&&"aborted"===e.requireError}export{Se as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{drainHandles as l,disposable as h,makeHandle as d,destroyHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as m,abortMaybe as y}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as G,whenOnce as T}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as A}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as E,isLoaded as M,load as k,project as H}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as P}from"../../geometry/support/coordsUtils.js";import{equals as I}from"../../geometry/support/spatialReferenceUtils.js";import D from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as j}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as U}from"../../support/elevationInfoUtils.js";import R from"../../symbols/CIMSymbol.js";import x from"../../symbols/FillSymbol3DLayer.js";import L from"../../symbols/MeshSymbol3D.js";import F from"../../symbols/SimpleFillSymbol.js";import V from"../../symbols/SimpleLineSymbol.js";import W from"../../symbols/SimpleMarkerSymbol.js";import K from"../../symbols/TextSymbol.js";import{symbolTypes as Z}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as q}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as N}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as z}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as B}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as $}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Y}from"../../views/input/InputManager.js";import{sketchKeys as X}from"../../views/interactive/keybindings.js";import J from"../../views/interactive/sketch/SketchLabelOptions.js";import Q from"../../views/interactive/sketch/SketchOptions.js";import ee from"../../views/interactive/sketch/SketchTooltipOptions.js";import te from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as oe}from"../../views/interactive/snapping/SnappingManager.js";import ie from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as ae}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as re}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as se}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ne}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as pe}from"../../views/support/screenUtils.js";import le from"./adapters/layer/GraphicsLayerAdapter.js";import he from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as de,DrawToolOperationHandle as ce,UpdateOperationHandle as ue}from"./support/OperationHandle.js";import{PluginManager as me}from"./support/PluginManager.js";import{SettingsManager as ye}from"./support/SettingsManager.js";import{getLegacyTool as ge,isCompletelyDegenerate as ve,graphicsHaveTooFewVerticesForBox as fe,getModeFromCreateOptions as _e,getDrawToolGeometryTypeFromCreateTool as be}from"./support/sketchUtils.js";const we={defaultZ:0},Ge={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:se},tool:"transform"},Te=Symbol(),Oe=Symbol();let Se=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new D({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new me({sketchViewModel:this}),this.settingsManager=new ye({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new C,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new re,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new F({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new V({color:[130,130,130,1],width:2}),this.meshSymbol=new L({symbolLayers:new s([new x])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Q,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Oe),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Oe)},this._originalPopupEnabled=null,this.defaultCreateOptions=we,this.defaultUpdateOptions=Ge,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new ie,this.textSymbol=new K({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=m(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new oe({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),ae(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=m(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new le(e);case"map-notes":return new he(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...we,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Ge,...e,reshapeOptions:{...Ge.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Ge.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=m(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new oe({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(G(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=y(this._moduleLoaderAbortController),this._viewReadyAbortController=y(this._viewReadyAbortController),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");$(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=ge(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||je(s)||($(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||I(o.geometry.spatialReference,t.spatialReference)||(E(o.geometry.spatialReference,t.spatialReference)||M()||await k(),o.geometry=H(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ne(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{j(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?A(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Y.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(pe(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=ge(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=_e(p,e),d=be(e),c=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=c?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:d,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...c};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Ee(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return je(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=[o.on("key-down",t=>{if(t.key===X.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===X.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==X.vertexAdd||t.repeat)t.key===X.undo?(t.stopPropagation(),n.undo()):t.key===X.redo?(t.stopPropagation(),n.redo()):t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===X.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Y.WIDGET),o.on("key-up",t=>{t.key===X.pan?e.enabled=!0:t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===X.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Y.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?n&&n.cancel():n&&n.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],n=new de({activeComponent:e,type:"create",onEnd:()=>{l(s),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===X.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},Y.WIDGET),a.on("key-up",e=>{e.key===X.pan&&(o.editable=!0)},Y.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===X.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||ve(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,h(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new ce({activeComponent:o,type:"create",onEnd:()=>{l(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return d();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),d(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new R({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Ge.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return fe(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,h=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const l of e){const e=new s({view:o,graphic:l}),t=N(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${q(t)}).`),null;p.set(l,e)}const d=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),d.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const c=[],u=new ue({activeComponent:d,tool:i,type:"update",onEnd:()=>{l(c),De(o,d),h()},undo:()=>{Pe(this.view,d),Me(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(d.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!je(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return c.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Y.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===B(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:h}=n.module,d=new h({graphic:e,view:o}),c=new p({object:d,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),this.updateGraphics.add(e);const u=[],m=new ue({activeComponent:c,tool:i,type:"update",onEnd:()=>{l(u),De(o,c),d.destroy()},undo:()=>{Pe(this.view,c),Me(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ke(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},Y.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:c}=h.module,u=this.view?.inputManager?.isModifierKeyDown(X.constraint),m=new d({view:o,graphic:e}),y=new c({object:m,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(y),i||this.updateGraphics.add(e);const g=[],v=new ue({activeComponent:y,tool:a,type:"update",onEnd:()=>{l(g),De(o,y),m.destroy()},canUndo:()=>!y.destroyed&&y.canUndo,undo:()=>{y.destroyed||(y.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!y.destroyed&&y.canRedo,redo:()=>{y.destroyed||(y.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!je(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Y.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Y.WIDGET),o.on("key-down",e=>{e.key!==X.constraint||e.repeat||(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},Y.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(je(a))return a;const r=new ue({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),l(p),l(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();Me(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ke(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==X.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(je(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),h=z(p);if(0!==h)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${q(h)}).`),null;const d=t.reshapeOptions,c=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===d?.vertexOperation,enableZShape:t.enableZ&&"move"===d?.shapeOperation,enableMoveObject:"move"===d?.shapeOperation||"move-xy"===d?.shapeOperation,enableMidpoints:"split"===d?.edgeOperation,enableEdgeOffset:"offset"===d?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(p.graphic);const u=[],m=new ue({activeComponent:c,tool:a,type:"update",onEnd:()=>{l(u),De(o,c),p.destroy()},canUndo:()=>!c.destroyed&&c.canUndo,undo:()=>{c.destroyed||(c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!c.destroyed&&c.canRedo,redo:()=>{c.destroyed||(c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));je(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;m.onEnd(),m.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));je(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},Y.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(je(a))return a;const r=new ue({activeComponent:a,type:"update",onEnd:()=>{l(n),l(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{Me(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ke(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(je(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():fe(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),je(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(l(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Y.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===X.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET),i.on("key-up",e=>{if(e.key===X.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return je(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(je(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(X.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return je(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>P(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>P(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Ie(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Ie(t.graphics))),o.on("scale-start",t=>e.addToHistory(Ie(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Ie([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Ie([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Ie([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=pe(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===X.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===X.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===X.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&X.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=m(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Te)}_displayCursor(e){this.removeHandles(Te),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Te)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??U("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(c(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return T(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(y(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(T(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Ae("view"))}_logMissingLayer(){this._logError(Ce,Ae("layer"))}};o([O()],Se.prototype,"_defaultSnappingManager",void 0),o([O()],Se.prototype,"_layerAdapter",null),o([O()],Se.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Se.prototype,"settingsManager",void 0),o([O()],Se.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Se.prototype,"_updatingHandles",void 0),o([O()],Se.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Se.prototype,"activeTool",null),o([O()],Se.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Se.prototype,"activeCreateToolDrawMode",null),o([O()],Se.prototype,"activeTooltip",null),o([O({types:Z})],Se.prototype,"activeFillSymbol",void 0),o([O()],Se.prototype,"activeLineSymbol",void 0),o([O()],Se.prototype,"activeVertexSymbol",void 0),o([O()],Se.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Se.prototype,"createGraphic",null),o([O()],Se.prototype,"defaultCreateOptions",null),o([O()],Se.prototype,"defaultUpdateOptions",null),o([O()],Se.prototype,"activeUpdateOptions",void 0),o([O({type:J,nonNullable:!0})],Se.prototype,"labelOptions",null),o([O()],Se.prototype,"layer",void 0),o([O({types:Z})],Se.prototype,"pointSymbol",void 0),o([O({types:Z})],Se.prototype,"polygonSymbol",void 0),o([O({types:Z})],Se.prototype,"polylineSymbol",void 0),o([O()],Se.prototype,"meshSymbol",void 0),o([O({type:K})],Se.prototype,"textSymbol",null),o([O({type:ie,nonNullable:!0})],Se.prototype,"snappingOptions",null),o([O()],Se.prototype,"snappingManager",null),o([O({readOnly:!0})],Se.prototype,"state",null),o([O({type:ee,nonNullable:!0})],Se.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Se.prototype,"updateGraphics",void 0),o([O()],Se.prototype,"updateOnGraphicClick",void 0),o([O()],Se.prototype,"updating",null),o([O()],Se.prototype,"creationMode",void 0),o([O({type:te,nonNullable:!0})],Se.prototype,"valueOptions",null),o([O({types:Z})],Se.prototype,"vertexSymbol",void 0),o([O({value:null})],Se.prototype,"view",null),o([O({constructOnly:!0,type:Q})],Se.prototype,"sketchOptions",void 0),o([O()],Se.prototype,"useLegacyCreateTools",void 0),o([O()],Se.prototype,"isUsingLegacyCreateTools",null),o([O()],Se.prototype,"pluginManager",null),o([O()],Se.prototype,"drawTool",null),o([O()],Se.prototype,"rootPlugins",null),o([O()],Se.prototype,"effectiveAvailablePlugins",null),o([O()],Se.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Se.prototype,"multiplePluginsActive",null),Se=o([S("esri.widgets.Sketch.SketchViewModel")],Se);const Ce="sketch:missing-property",Ae=e=>`Property '${e}' is missing on SketchViewModel.`;function Ee(e){return"polygon"===e||"rectangle"===e||"circle"===e}function Me(e,t){He("undo",e.history.undo,e.history.redo,t)}function ke(e,t){He("redo",e.history.redo,e.history.undo,t)}function He(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function Pe(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Ie(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function De(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function je(e){return"requireError"in e&&"aborted"===e.requireError}export{Se as default};
|