@arcgis/core 5.2.0-next.136 → 5.2.0-next.138
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/LineOfSightAnalysisObserver.d.ts +12 -0
- package/analysis/LineOfSightAnalysisObserver.js +1 -1
- package/analysis/LineOfSightAnalysisTarget.d.ts +12 -0
- package/analysis/LineOfSightAnalysisTarget.js +1 -1
- package/arcade/featureset/sources/FeatureLayerParquet.js +1 -1
- package/arcgisGlobal.d.ts +4 -0
- package/assets/components/assets/icon/blockHeightMedium16.json +1 -0
- package/assets/components/assets/icon/blockHeightMedium24.json +1 -0
- package/assets/components/assets/icon/blockHeightMedium32.json +1 -0
- package/assets/components/assets/icon/blockHeightShort16.json +1 -0
- package/assets/components/assets/icon/blockHeightShort24.json +1 -0
- package/assets/components/assets/icon/blockHeightShort32.json +1 -0
- package/assets/components/assets/icon/blockHeightTall16.json +1 -0
- package/assets/components/assets/icon/blockHeightTall24.json +1 -0
- package/assets/components/assets/icon/blockHeightTall32.json +1 -0
- package/assets/components/assets/icon/cursorCircle16.json +1 -0
- package/assets/components/assets/icon/cursorCircle24.json +1 -0
- package/assets/components/assets/icon/cursorCircle32.json +1 -0
- package/assets/components/assets/icon/dictionary16.json +1 -0
- package/assets/components/assets/icon/dictionary24.json +1 -0
- package/assets/components/assets/icon/dictionary32.json +1 -0
- package/assets/components/assets/icon/jobDependency16.json +1 -0
- package/assets/components/assets/icon/jobDependency24.json +1 -0
- package/assets/components/assets/icon/jobDependency32.json +1 -0
- package/assets/components/assets/icon/referenceChip16.json +1 -0
- package/assets/components/assets/icon/referenceChip24.json +1 -0
- package/assets/components/assets/icon/referenceChip32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4e6f95d8c624d513849a.js → 05963f57cbe5a5249496.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b8681ca4a83e97f1f71.js → 067de1910190da228291.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c0fd1c6cda44e9f40ab.js → 070684943698fa43c2b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc1cb4b9a02e6c78deb7.js → 076e8d2e08ff2a013736.js} +1 -1
- package/assets/esri/core/workers/chunks/{c10e040368065411506a.js → 10445313d0d57b34511b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d537c59b46cdaaf66034.js → 1188d0a136fffc009643.js} +1 -1
- package/assets/esri/core/workers/chunks/{20af3f085f60c32c6c53.js → 178083d8ed7707b45ca2.js} +1 -1
- package/assets/esri/core/workers/chunks/{f5efe3e800c6e23efcf3.js → 1819c45655c836b9a8d7.js} +1 -1
- package/assets/esri/core/workers/chunks/1b946714ca4a1a7359d4.js +2 -0
- package/assets/esri/core/workers/chunks/{d8d8b38ac8a91d9e45fc.js → 1cc744ab5eee5ee3bed8.js} +1 -1
- package/assets/esri/core/workers/chunks/{05e39b4de7f62c5b22cc.js → 20f75cc777af13fa249b.js} +1 -1
- package/assets/esri/core/workers/chunks/2a1ec30f9ad305763f81.js +2 -0
- package/assets/esri/core/workers/chunks/34570e6bbf559f18c1a5.js +1 -0
- package/assets/esri/core/workers/chunks/{60f6d5da9480dd36e877.js → 3dddae78286d05eb10fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{9efd30bbd02ec0d1031b.js → 3ec3589f6e74d7cb87cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{0bec054fca104f3bf141.js → 3f776d9fd2ab68b21fca.js} +1 -1
- package/assets/esri/core/workers/chunks/402a82c77420254831bc.js +1 -0
- package/assets/esri/core/workers/chunks/{e2ebf0ea3af2e6907987.js → 406f24ec13eb30d43405.js} +1 -1
- package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +1 -0
- package/assets/esri/core/workers/chunks/{ddedc414bb478b376221.js → 46b2d4addfc73f9183a4.js} +1 -1
- package/assets/esri/core/workers/chunks/498d6dfd3bb0d3490548.js +1 -0
- package/assets/esri/core/workers/chunks/{36ef86701883a20dd6f6.js → 4a640548032355e57acd.js} +1 -1
- package/assets/esri/core/workers/chunks/5566f14afb63065e438f.js +1 -0
- package/assets/esri/core/workers/chunks/{c3b96d1d43afccd23e45.js → 590e6c70206122e4cc3c.js} +2 -2
- package/assets/esri/core/workers/chunks/{54860dd53a46cf4c47f3.js → 59295b99bdff4045a0e7.js} +1 -1
- package/assets/esri/core/workers/chunks/5aeb5e18514644fe2cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{5da86409d70098fc6a10.js → 5b3cfe95314a75a735c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{a54678bfa0f1807b61cd.js → 5c855af73ee3c3e764fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{06da3409992bb1fa85b0.js → 5e90c1b49f2b7e21d05a.js} +39 -31
- package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +1 -0
- package/assets/esri/core/workers/chunks/{30f808cac8a34f95ea6e.js → 6079d27f4ab319fb8f0c.js} +1 -1
- package/assets/esri/core/workers/chunks/66c2a28a851130b87c04.js +1 -0
- package/assets/esri/core/workers/chunks/{dac90b3631f7f7158f68.js → 67f15538c51838201fc7.js} +1 -1
- package/assets/esri/core/workers/chunks/{cfaba0470619786e1ef8.js → 68d8ae42ab71d01a70a5.js} +2 -2
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +1 -0
- package/assets/esri/core/workers/chunks/{864e7030c4ddbfcf0114.js → 6ccf9535013fe672c93b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba7f0cf7e495d3ec2d55.js → 6e62581d933e7298d1f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{83b5dd4029e00abd80bf.js → 700b1d5bc67b7e1b3ff3.js} +1 -1
- package/assets/esri/core/workers/chunks/{f9fea72cc222a30ef2f9.js → 72399062767abdfb0bee.js} +1 -1
- package/assets/esri/core/workers/chunks/{2a7fbfd77002a24bf737.js → 747461bb6a1bc2f0a64d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c333f6ed42985bb2b11f.js → 7851aef196eea5d6c94e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f0b6bd6fab5320c3082f.js → 7a05b18f655c1167ce0a.js} +1 -1
- package/assets/esri/core/workers/chunks/{04296b75d0f81fbd1bb5.js → 864194927d05ebc4cc31.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c4a13a9f0b305394a26.js → 876f7633c15f1e31078d.js} +1 -1
- package/assets/esri/core/workers/chunks/{62298dba3f6cbdc3f4ae.js → 879b2f0ff1977bca9376.js} +1 -1
- package/assets/esri/core/workers/chunks/{b547b3bce729c9dac90d.js → 898359be6996fd9763b8.js} +1 -1
- package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +1 -0
- package/assets/esri/core/workers/chunks/8dc1c3042267618fd710.js +2 -0
- package/assets/esri/core/workers/chunks/{625f02db93d7fbf175ca.js → 9001e9a1e81bce175ddd.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ffa6c8d93d3443834c6.js → 912080c90b5cc2e817cf.js} +1 -1
- package/assets/esri/core/workers/chunks/96c50a0dda0f1503ef92.js +2 -0
- package/assets/esri/core/workers/chunks/{13e4379441499599c3b5.js → 9cbde13e536676767900.js} +1 -1
- package/assets/esri/core/workers/chunks/{408db4f32850b77264ae.js → 9cd3fcb5fca6f9dbbcd8.js} +1 -1
- package/assets/esri/core/workers/chunks/a054da6cbd8ee4774a57.js +1 -0
- package/assets/esri/core/workers/chunks/a05790444115e4cf1bcc.js +1 -0
- package/assets/esri/core/workers/chunks/{d1f2685782b423ef87a6.js → a556dd4e9e6d35e33a2c.js} +1 -1
- package/assets/esri/core/workers/chunks/{00d576d355599c88931e.js → bc38def1983089514e4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0725e515f3004bdd5c56.js → ca2adcbcf44454484fd5.js} +1 -1
- package/assets/esri/core/workers/chunks/{f3507b9e831ffd7a6bf8.js → cca8bd07bcd1d267a2e8.js} +1 -1
- package/assets/esri/core/workers/chunks/cfae60b9d2f2939e9c16.js +1 -0
- package/assets/esri/core/workers/chunks/{1d6b2a64f4e40e5cc13d.js → d201fbf3ceff946d2bd6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4439078780d9ba49fd26.js → d51bb11baadc741c46bc.js} +1 -1
- package/assets/esri/core/workers/chunks/db1ab9b9c8bf5c7635d3.js +1 -0
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +1 -0
- package/assets/esri/core/workers/chunks/e630f3c56c077cb2bd8e.js +1 -0
- package/assets/esri/core/workers/chunks/e81173724e8de8c1e65b.js +1 -0
- package/assets/esri/core/workers/chunks/{2025288bed125594ceda.js → f6e62d2d279a328cbed7.js} +1 -1
- package/assets/esri/core/workers/chunks/{47c19778fcee7154ca38.js → f8bc474434fd365ab174.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a20dc26cb9c7b2087cf.js → f95a1f878c9c1146180e.js} +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.en.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-TW.json +1 -1
- package/chunks/Bufferer-CclWhXVb.js +1 -1
- package/chunks/Component.glsl.js +3 -3
- package/chunks/DefaultMaterial.glsl.js +2 -2
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/Envelope2D.js +1 -1
- package/chunks/FocusArea.glsl.js +8 -10
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/GeodeticUtils.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-CIE8Wfmb.js +1 -1
- package/chunks/GlobalIllumination.glsl.js +3 -3
- package/chunks/LineMarker.glsl.js +35 -42
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorAffineTransform.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorDensify.js +1 -1
- package/chunks/OperatorDistance.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorGraphicBuffer.js +1 -1
- package/chunks/OperatorIntegrate.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/Path.glsl.js +2 -2
- package/chunks/Point2D.js +1 -1
- package/chunks/RealisticTree.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +51 -57
- package/chunks/SideCalculator2D-DX0718xq.js +1 -1
- package/chunks/Terrain.glsl.js +2 -2
- package/chunks/Transformation2D.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/config.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/editing/fieldUtils.d.ts +12 -0
- package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/ellipseUtils.js +2 -0
- package/interfaces.d.ts +15 -18
- package/kernel.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/list/LayerItemCollection.d.ts +1 -0
- package/layers/list/types.d.ts +5 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/queries.js +1 -1
- package/layers/support/TimeSeriesCalculation.d.ts +1 -1
- package/layers/support/TimeSeriesCalculation.js +1 -1
- package/layers/support/dataSeriesUtils.d.ts +10 -0
- package/layers/support/timeSeriesUtils.js +17 -6
- package/libs/lyr3d/Lyr3DModule.js +1 -1
- package/networks/UtilityNetwork.d.ts +15 -0
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +4 -4
- package/popup/FeatureContent.d.ts +14 -1
- package/popup/FeatureContent.js +1 -1
- package/popup/FeatureContentCollection.d.ts +4 -10
- package/popup/FeatureContentCollection.js +1 -1
- package/popup/actions.js +1 -1
- package/popup/support/featureUtils.js +1 -1
- package/renderers/support/RenderingInfo.js +1 -1
- package/renderers/support/renderingInfoUtils.js +1 -1
- package/renderers/visualVariables/SizeVariable.d.ts +16 -20
- package/renderers/visualVariables/support/SizeStop.d.ts +6 -2
- package/rest/networks/support/TraceLocation.js +1 -1
- package/rest/networks/support/TraceResult.d.ts +7 -0
- package/rest/networks/support/TraceResult.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/opacity.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/timeSeriesUtils.js +1 -1
- package/smartMapping/statistics/histogramForTimeSeries.d.ts +11 -0
- package/smartMapping/statistics/histogramForTimeSeries.js +2 -0
- package/smartMapping/statistics/summaryStatisticsForTimeSeries.d.ts +11 -0
- package/smartMapping/statistics/summaryStatisticsForTimeSeries.js +2 -0
- package/smartMapping/statistics/support/timeSeriesUtils.js +24 -0
- package/smartMapping/statistics/types.d.ts +50 -0
- package/support/tests/serviceMockDependencies.js +1 -1
- package/support/tests/setupServiceMocksMesh.js +1 -1
- package/symbols/cim/CIMPlacements.js +1 -1
- package/symbols/cim/callouts/calloutAnalysisUtils.js +1 -1
- package/symbols/cim/callouts/effects/BackgroundCallout.js +1 -1
- package/symbols/cim/callouts/effects/BalloonCallout.js +1 -1
- package/symbols/cim/callouts/effects/PointSymbolCallout.js +1 -1
- package/symbols/cim/callouts/effects/calloutUtils.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/jobsUtil.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/ComputedAnimatedParams.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextParams.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/layers/SketchLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/labelingUtils.js +1 -1
- package/views/2d/layers/features/schema/ExceedsLimitCache.js +1 -1
- package/views/2d/layers/features/schema/TimeSchema.js +2 -0
- package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
- package/views/2d/layers/support/visualVariableSimpleUtils.js +1 -1
- package/views/2d/types.d.ts +2 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +24 -0
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/camera/constraintUtils.js +1 -1
- package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +1 -1
- package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/placementTools/GroundNavigationPlacementTool3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/state/controllers/GroundNavigationController.js +1 -1
- package/views/3d/state/controllers/momentum/GroundNavigationMomentumController.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +16 -8
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +5 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/evaluateSceneLightingFragment.glsl.js +12 -0
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/focusArea/FocusArea.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/SelectionManager.d.ts +3 -3
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/options/bindViewToolOptions.js +1 -1
- package/views/interactive/sketch/SketchLabelOptions.d.ts +3 -0
- package/views/interactive/sketch/SketchLabelOptions.js +1 -1
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +3 -0
- package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
- package/views/interactive/sketch/SketchValueOptions.d.ts +3 -0
- package/views/interactive/sketch/SketchValueOptions.js +1 -1
- package/views/interactive/snapping/SnappingOptions.d.ts +3 -0
- package/views/interactive/snapping/SnappingOptions.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
- package/views/layers/SketchLayerView.d.ts +34 -0
- package/views/layers/SketchLayerView.js +2 -0
- package/views/layers/types.d.ts +3 -2
- package/views/selection/types.d.ts +15 -4
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.d.ts +4 -0
- package/widgets/Bookmarks/BookmarksVisibleElements.d.ts +5 -1
- package/widgets/Bookmarks/types.d.ts +2 -0
- package/widgets/Editor/EditorViewModel.d.ts +31 -30
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/types.d.ts +44 -0
- package/widgets/Editor.d.ts +30 -27
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.d.ts +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.d.ts +6 -0
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Histogram/types.d.ts +10 -2
- package/widgets/HistogramRangeSlider/types.d.ts +4 -1
- package/widgets/LayerList/LayerListViewModel.d.ts +2 -1
- package/widgets/Legend/LegendViewModel.d.ts +2 -0
- package/widgets/Legend/styles/card/CardView.d.ts +2 -0
- package/widgets/Legend/styles/classic/ClassicView.d.ts +4 -1
- package/widgets/Legend.d.ts +3 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.d.ts +7 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/support/VideoFeatureCache.js +2 -0
- package/widgets/OrientedImageryViewer/types.d.ts +9 -0
- package/widgets/OrientedImageryViewer.d.ts +7 -0
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/types.d.ts +9 -2
- package/widgets/Sketch/SketchViewModel.d.ts +32 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.d.ts +27 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slider/types.d.ts +58 -13
- package/widgets/Slider.d.ts +6 -0
- package/widgets/smartMapping/BinaryColorSizeSlider/BinaryColorSizeSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/ClassedColorSlider/ClassedColorSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/ClassedSizeSlider/ClassedSizeSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/ColorSizeSlider/ColorSizeSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/ColorSlider/ColorSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/OpacitySlider/OpacitySliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.d.ts +3 -0
- package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/SmartMappingSliderViewModel.d.ts +2 -0
- package/widgets/smartMapping/types.d.ts +30 -7
- package/widgets/support/FilterBuilder/FilterBuilderViewModel.d.ts +21 -11
- package/widgets/support/FilterBuilder/FilterBuilderViewModel.js +1 -1
- package/widgets/support/FilterBuilder/types.d.ts +28 -0
- package/widgets/support/FilterBuilder.js +1 -1
- package/widgets/support/FilterCondition/FilterConditionViewModel.d.ts +24 -0
- package/widgets/support/FilterCondition/FilterConditionViewModel.js +1 -1
- package/widgets/support/FilterCondition/types.d.ts +16 -1
- package/widgets/support/FilterCondition.js +1 -1
- package/widgets/support/SnappingControls/snappingLayerListUtils.js +1 -1
- package/widgets/support/iconUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0606ab6fdfc1dfea3856.js +0 -1
- package/assets/esri/core/workers/chunks/078dcd17f46403d44b24.js +0 -1
- package/assets/esri/core/workers/chunks/1289204f8ca96032c17a.js +0 -1
- package/assets/esri/core/workers/chunks/12b5a645c0987a0efe54.js +0 -2
- package/assets/esri/core/workers/chunks/152fe3d6ad7aebbd23d1.js +0 -1
- package/assets/esri/core/workers/chunks/17b938ba49fb1e7ab8c4.js +0 -1
- package/assets/esri/core/workers/chunks/1dbb3e25e005a8220779.js +0 -2
- package/assets/esri/core/workers/chunks/3d6fef25af7e1a51e1bd.js +0 -1
- package/assets/esri/core/workers/chunks/3ef367c9b7bf1588307d.js +0 -1
- package/assets/esri/core/workers/chunks/5f4feca26102088ea565.js +0 -1
- package/assets/esri/core/workers/chunks/74211d096cc3296e0968.js +0 -1
- package/assets/esri/core/workers/chunks/7926faab76a721a2e1c4.js +0 -1
- package/assets/esri/core/workers/chunks/ad28486bc6afaa346de5.js +0 -1
- package/assets/esri/core/workers/chunks/ad29c729e90b5866713c.js +0 -1
- package/assets/esri/core/workers/chunks/b72a2514aa4cc4ae7d1b.js +0 -1
- package/assets/esri/core/workers/chunks/bb51cf52b8ea8283f4f8.js +0 -1
- package/assets/esri/core/workers/chunks/be761749f8d77fbd9df5.js +0 -1
- package/assets/esri/core/workers/chunks/dbfd25aa0d19aed5890c.js +0 -1
- package/assets/esri/core/workers/chunks/de28a86775235bd5d3c4.js +0 -2
- package/assets/esri/core/workers/chunks/f6cfc901267a229de7a1.js +0 -2
- package/assets/esri/core/workers/chunks/fb147097149a89e671ff.js +0 -1
- package/support/revision.js +0 -2
- /package/assets/esri/core/workers/chunks/{1dbb3e25e005a8220779.js.LICENSE.txt → 1b946714ca4a1a7359d4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f6cfc901267a229de7a1.js.LICENSE.txt → 2a1ec30f9ad305763f81.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c3b96d1d43afccd23e45.js.LICENSE.txt → 590e6c70206122e4cc3c.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{cfaba0470619786e1ef8.js.LICENSE.txt → 68d8ae42ab71d01a70a5.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{de28a86775235bd5d3c4.js.LICENSE.txt → 8dc1c3042267618fd710.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{12b5a645c0987a0efe54.js.LICENSE.txt → 96c50a0dda0f1503ef92.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{makeHandle as o,drainHandles as s,destroyHandle as c}from"../../core/handleUtils.js";import has from"../../core/has.js";import l from"../../core/Logger.js";import{destroyMaybe as u,abortMaybe as d}from"../../core/maybe.js";import{createAbortError as f,ignoreAbortErrors as p,whenOrAbort as m}from"../../core/promiseUtils.js";import{watch as h,syncAndInitial as g,on as _,when as ee,whenOnce as v}from"../../core/reactiveUtils.js";import{property as y,subclass as te}from"../../core/accessorSupport/decorators.js";import{trackAccess as b}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ne}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as x}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as re}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as ie,isLoaded as ae,load as oe,project as se}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as S}from"../../geometry/support/coordsUtils.js";import{equals as ce}from"../../geometry/support/spatialReferenceUtils.js";import le from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as ue}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as de}from"../../support/elevationInfoUtils.js";import fe from"../../symbols/FillSymbol3DLayer.js";import pe from"../../symbols/MeshSymbol3D.js";import C from"../../symbols/SimpleFillSymbol.js";import w from"../../symbols/SimpleLineSymbol.js";import T from"../../symbols/SimpleMarkerSymbol.js";import E from"../../symbols/TextSymbol.js";import{symbolTypes as D}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as O}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as me}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as he}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as ge}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as k}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as A}from"../../views/input/InputManager.js";import{sketchKeys as j}from"../../views/interactive/keybindings.js";import _e from"../../views/interactive/sketch/SketchLabelOptions.js";import M from"../../views/interactive/sketch/SketchOptions.js";import ve from"../../views/interactive/sketch/SketchTooltipOptions.js";import N from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as ye}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as I}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as be}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as xe}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Se from"./adapters/layer/GraphicsLayerAdapter.js";import Ce from"./adapters/layer/MapNotesLayerAdapter.js";import we from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as Te,DrawToolOperationHandle as Ee,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as De}from"./support/PluginManager.js";import{SettingsManager as Oe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as ke,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ae,getDrawToolGeometryTypeFromCreateTool as je}from"./support/sketchUtils.js";const V={defaultZ:0},H={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:be},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new le({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new De({sketchViewModel:this}),this.settingsManager=new Oe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new x,this._toolTransitionHandles=new x,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new I,this._viewHandlesKey=`viewHandles`,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new T({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new C({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new w({color:[130,130,130,1],width:2}),this.meshSymbol=new pe({symbolLayers:new r([new fe])}),this.updateGraphics=new r,this.updateOnGraphicClick=!0,this.cancelUpdateOnClickAway=!0,this.creationMode=`single`,this.vertexSymbol=new T({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new M,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),h(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},g)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new E({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([_(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),h(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),g),h(()=>this.view,e=>{this._defaultSnappingManager=u(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},g),h(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),ye(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=u(this._defaultSnappingManager),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=d(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Se(e);case`map-notes`:return new Ce(e);case`sketch`:return new we(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(n).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.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){this._defaultSnappingManager!=null&&(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=u(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||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){let t=this._get(`view`);if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(ee(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},g),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(n)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let 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(n)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(e)}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=d(this._moduleLoaderAbortController),this._viewReadyAbortController=d(this._viewReadyAbortController),this._drawToolSimplifyAbortController=d(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let 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){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),f();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}k(n,this._internalGraphicsLayer);let i=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(i==null||this.destroyed){n.map?.remove(this._internalGraphicsLayer);return}let a=z(e);i.on(`complete`,()=>{if(i===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!i.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:a??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:o}=this;if(o===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(p(this.create(e,t)))}else o===`update`&&n&&this._updatingHandles.consumePromise(p(this.update([n])))}}),this._operationHandle=i,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),f();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(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;let o=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t));this.destroyed||o==null||$(o)||(k(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(o,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:o.tool,toolEventInfo:null,type:`update`}))}async _updateSpatialReference(e){let t=this.view;if(!t){this._logMissingView();return}e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!ce(n.geometry.spatialReference,t.spatialReference)&&(!ie(n.geometry.spatialReference,t.spatialReference)&&!ae()&&await oe(),n.geometry=se(n.geometry,t.spatialReference))}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return xe(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{ue(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.viewingMode===`global`?re(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},A.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(L(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r.mode):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Ae(c,e),d=je(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this.snappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Ne(e.geometryType)?this.activeFillSymbol:null,toolOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=e.forceUniformSize,a=e.centered,c=new ne,l=[o(()=>c.destroy()),n.on(`key-down`,t=>{if(t.key===j.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===j.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===j.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===j.undo?(t.stopPropagation(),u.undo()):t.key===j.redo?(t.stopPropagation(),u.redo()):t.key===j.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===j.center&&(t.repeat||(e.centered=!a,t.stopPropagation()))},A.WIDGET),n.on(`key-up`,t=>{t.key===j.pan?e.enabled=!0:t.key===j.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=i,t.stopPropagation()):t.key===j.center&&(e.centered=a,t.stopPropagation())},A.WIDGET),e.on(`vertex-update`,()=>{c.notify()}),e.on(`vertex-add`,t=>{switch(c.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(c.notify(),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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),h(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new Te({activeComponent:e,type:`create`,onEnd:()=>{s(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(b(c),e.canUndo),canRedo:()=>(b(c),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===j.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},A.WIDGET),r.on(`key-up`,t=>{t.key===j.pan&&(e.editable=!0)},A.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===j.vertexAdd&&t.preventDefault();return}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();if(!n||ke(n)){t.preventDefault();return}}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(p(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Ee({activeComponent:e,type:`create`,onEnd:()=>{s(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=d(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:c}=a.module,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=me(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${O(r)}).`),null;l.set(t,e)}let d=new c({view:n,enableZ:t.enableZ,snappingManager:this.snappingManager,toolOptions:this.sketchOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{s(f),Q(n,d),u()},undo:()=>{X(this.view,d),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});l.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.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`}),this.updateGraphics.length===0){p.complete();return}let n=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),A.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},A.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&ge(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,c=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(c))return c;let{TransformTool3D:l,ManipulatedObject3DGraphic:u}=c.module,d=new u({graphic:e,view:n}),f=new l({object:d,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this.snappingManager,toolOptions:this.sketchOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{s(p),Q(n,f),d.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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();let r=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0));$(r)||this._setUpdateOperationHandle(r,t)},removeFromSelection:async 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()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),A.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},A.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:c,preserveAspectRatio:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(j.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:c,preserveAspectRatio:!!l!=!!p,toolOptions:this.sketchOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{s(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.redo(),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`}),_.onEnd(),_.destroy();let r=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0));$(r)||this._setUpdateOperationHandle(r,t)},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),A.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),A.WIDGET),n.on(`key-down`,e=>{e.key===j.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},A.WIDGET),n.on(`key-up`,e=>{e.key===j.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},A.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),s(l),s(c),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();if(this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0){a.complete();return}i.graphics=n}}),o=!1,c=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),A.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===j.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},A.WIDGET),n.on(`key-up`,e=>{e.key===j.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},A.WIDGET)],l=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:c}=a.module,l=new o({view:n,graphic:e}),u=he(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${O(u)}).`),null;let d=t.reshapeOptions,f=new c({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this.snappingManager,toolOptions:this.sketchOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{s(p),Q(n,f),l.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.redo(),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();let r=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0));$(r)||this._setUpdateOperationHandle(r,t)},removeFromSelection:async 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(t.toggleToolOnClick===!1)return;m.onEnd(),m.destroy();let e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0));$(e)||this._setUpdateOperationHandle(e,t)}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),A.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},A.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{s(c),s(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),a.onEnd(),a.destroy();let i=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,`transform`,n,r));if($(i))return;this._setUpdateOperationHandle(i,n)}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),!$(i)&&(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(s(c),c=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),A.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===j.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},A.WIDGET),r.on(`key-up`,e=>{if(e.key===j.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},A.WIDGET)],c=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(j.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions: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(h(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},g)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,toolOptions:this.sketchOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>S(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>S(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;if(i.native?.shiftKey&&this.hasGraphic(r)){i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r));return}t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=L(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;if(a){t.stopPropagation(),await a;return}this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===j.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===j.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===j.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&j.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),u(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){l.getLogger(this).error(new i(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_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(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??de(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this.sketchOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(c(o));let l=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(h(()=>this._getGraphicSymbolFromTool(r),e=>l.symbol=e)),this._set(`createGraphic`,l),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return v(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;if(!e){this._logMissingView();return}d(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await m(v(()=>e?.ready),this._viewReadyAbortController.signal)}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Me,K(`layer`))}};e([y()],G.prototype,`_defaultSnappingManager`,void 0),e([y()],G.prototype,`_layerAdapter`,null),e([y()],G.prototype,`_pluginManager`,void 0),e([y({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([y()],G.prototype,`_operationHandle`,void 0),e([y({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([y({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([y()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([y({readOnly:!0})],G.prototype,`activeTool`,null),e([y()],G.prototype,`geometrySimplificationInProgress`,null),e([y({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([y()],G.prototype,`activeTooltip`,null),e([y({types:D})],G.prototype,`activeFillSymbol`,void 0),e([y()],G.prototype,`activeLineSymbol`,void 0),e([y()],G.prototype,`activeVertexSymbol`,void 0),e([y()],G.prototype,`allowDeleteKey`,void 0),e([y({readOnly:!0})],G.prototype,`createGraphic`,null),e([y()],G.prototype,`defaultCreateOptions`,null),e([y()],G.prototype,`defaultUpdateOptions`,null),e([y()],G.prototype,`activeUpdateOptions`,void 0),e([y({type:_e,nonNullable:!0})],G.prototype,`labelOptions`,null),e([y()],G.prototype,`layer`,void 0),e([y({types:D})],G.prototype,`pointSymbol`,void 0),e([y({types:D})],G.prototype,`polygonSymbol`,void 0),e([y({types:D})],G.prototype,`polylineSymbol`,void 0),e([y()],G.prototype,`meshSymbol`,void 0),e([y({type:E})],G.prototype,`textSymbol`,null),e([y({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([y()],G.prototype,`snappingManager`,null),e([y({readOnly:!0})],G.prototype,`state`,null),e([y()],G.prototype,`toolTransitionInProgress`,null),e([y({type:ve,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([y({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([y()],G.prototype,`updateOnGraphicClick`,void 0),e([y()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([y()],G.prototype,`updating`,null),e([y()],G.prototype,`creationMode`,void 0),e([y({type:N,nonNullable:!0})],G.prototype,`valueOptions`,null),e([y({types:D})],G.prototype,`vertexSymbol`,void 0),e([y({value:null})],G.prototype,`view`,null),e([y({constructOnly:!0,type:M})],G.prototype,`sketchOptions`,void 0),e([y()],G.prototype,`useLegacyCreateTools`,void 0),e([y()],G.prototype,`isUsingLegacyCreateTools`,null),e([y()],G.prototype,`pluginManager`,null),e([y()],G.prototype,`drawTool`,null),e([y()],G.prototype,`activePluginConfigurations`,null),e([y()],G.prototype,`rootPlugins`,null),e([y()],G.prototype,`effectiveAvailablePlugins`,null),e([y()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([y()],G.prototype,`multiplePluginsActive`,null),G=e([te(`esri.widgets.Sketch.SketchViewModel`)],G);const Me=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function Ne(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{handlesGroup as o,makeHandle as s,drainHandles as c,destroyHandle as l}from"../../core/handleUtils.js";import has from"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as f,removeMaybe as p}from"../../core/maybe.js";import{createAbortError as m,ignoreAbortErrors as h,whenOrAbort as g}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as v,on as ee,when as te,sync as ne,whenOnce as y}from"../../core/reactiveUtils.js";import{property as b,subclass as re}from"../../core/accessorSupport/decorators.js";import{trackAccess as x}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ie}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ae}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as oe,isLoaded as se,load as ce,project as le}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as ue}from"../../geometry/support/spatialReferenceUtils.js";import de from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as fe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as pe}from"../../support/elevationInfoUtils.js";import me from"../../symbols/FillSymbol3DLayer.js";import he from"../../symbols/MeshSymbol3D.js";import ge from"../../symbols/SimpleFillSymbol.js";import _e from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import T from"../../symbols/TextSymbol.js";import{symbolTypes as E}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ve}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as be}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as O}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as k}from"../../views/input/InputManager.js";import{sketchKeys as A}from"../../views/interactive/keybindings.js";import{bindViewToolOptions as xe}from"../../views/interactive/options/bindViewToolOptions.js";import j from"../../views/interactive/options/InteractiveToolOptions.js";import M from"../../views/interactive/sketch/SketchLabelOptions.js";import N from"../../views/interactive/sketch/SketchOptions.js";import Se from"../../views/interactive/sketch/SketchTooltipOptions.js";import Ce from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import{acquire as we}from"../../views/interactive/snapping/SnappingManagerPool.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as I}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as Te}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Ee}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as De}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Oe from"./adapters/layer/GraphicsLayerAdapter.js";import ke from"./adapters/layer/MapNotesLayerAdapter.js";import Ae from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as je,DrawToolOperationHandle as Me,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Ne}from"./support/PluginManager.js";import{SettingsManager as Pe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Fe,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ie,getDrawToolGeometryTypeFromCreateTool as Le}from"./support/sketchUtils.js";const V={defaultZ:0},H={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:Ee},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Ne({sketchViewModel:this}),this.settingsManager=new Pe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new Te,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 ge({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new _e({color:[130,130,130,1],width:2}),this.meshSymbol=new he({symbolLayers:new r([new me])}),this.updateGraphics=new r,this.updateOnGraphicClick=!0,this.useViewOptions=!1,this.cancelUpdateOnClickAway=!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 N,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},v)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new T({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([ee(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),v),_(()=>this.view,e=>{this._defaultSnappingManager=d(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},v),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),I(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=d(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _operationSnappingManager(){return this._operationContext?.snappingManager??this.snappingManager}get _operationToolOptions(){return this._operationContext?.toolOptions??this.sketchOptions}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Oe(e);case`map-notes`:return new ke(e);case`sketch`:return new Ae(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(n).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.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){this._defaultSnappingManager!=null&&(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=d(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||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){let t=this._get(`view`);if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(te(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},v),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(n)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let 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(n)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(e)}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=f(this._moduleLoaderAbortController),this._viewReadyAbortController=f(this._viewReadyAbortController),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let 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){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),m();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}O(n,this._internalGraphicsLayer);let i=this._createOperationContext(n),a;try{a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t))}catch(e){throw this._destroyOperationContext(i),e}if(a==null||this.destroyed||i!==this._operationContext){let e=i===this._operationContext;a?.onEnd(),d(a),this._destroyOperationContext(i),e&&n.map?.remove(this._internalGraphicsLayer);return}let o=z(e);a.on(`complete`,()=>{if(a===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!a.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:o??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:i}=this;if(i===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(h(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(h(this.update([n])))}}),this._operationHandle=a,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),m();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(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;let o=this._createOperationContext(r),s;try{s=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t))}catch(e){throw this._destroyOperationContext(o),e}if(this.destroyed||s==null||$(s)||o!==this._operationContext){s&&!$(s)&&(s.onEnd(),s.destroy()),this._destroyOperationContext(o);return}O(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:s.tool,toolEventInfo:null,type:`update`})}async _updateSpatialReference(e){let t=this.view;if(!t){this._logMissingView();return}e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!ue(n.geometry.spatialReference,t.spatialReference)&&(!oe(n.geometry.spatialReference,t.spatialReference)&&!se()&&await ce(),n.geometry=le(n.geometry,t.spatialReference))}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}_createOperationContext(e){this._destroyOperationContext();let t=this.useViewOptions?e.options:null,n=t?we(e):null,r=t?new j:this.sketchOptions,i;if(t){let{values:t}=r;i=o([xe(r,()=>e.options,()=>this.sketchOptions),_(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},ne)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...o([n,i])}}_destroyOperationContext(e=this._operationContext){if(e!==this._operationContext){p(e);return}this._operationContext=p(this._operationContext)}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return De(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{fe(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.viewingMode===`global`?ae(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},k.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(L(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r.mode):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Ie(c,e),d=Le(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this._operationSnappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ze(e.geometryType)?this.activeFillSymbol:null,toolOptions:this._operationToolOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this._operationToolOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=e.forceUniformSize,a=e.centered,o=new ie,l=[s(()=>o.destroy()),n.on(`key-down`,t=>{if(t.key===A.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===A.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===A.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===A.undo?(t.stopPropagation(),u.undo()):t.key===A.redo?(t.stopPropagation(),u.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!a,t.stopPropagation()))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan?e.enabled=!0:t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=i,t.stopPropagation()):t.key===A.center&&(e.centered=a,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{o.notify()}),e.on(`vertex-add`,t=>{switch(o.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(o.notify(),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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new je({activeComponent:e,type:`create`,onEnd:()=>{c(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(x(o),e.canUndo),canRedo:()=>(x(o),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),r.on(`key-up`,t=>{t.key===A.pan&&(e.editable=!0)},k.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===A.vertexAdd&&t.preventDefault();return}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();if(!n||Fe(n)){t.preventDefault();return}}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(h(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Me({activeComponent:e,type:`create`,onEnd:()=>{c(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:s}=a.module,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ve(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;l.set(t,e)}let d=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{c(f),Q(n,d),u()},undo:()=>{X(this.view,d),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});l.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.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`}),this.updateGraphics.length===0){p.complete();return}let n=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},k.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&be(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,s=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(s))return s;let{TransformTool3D:l,ManipulatedObject3DGraphic:u}=s.module,d=new u({graphic:e,view:n}),f=new l({object:d,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{c(p),Q(n,f),d.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!l!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{c(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.redo(),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`}),await this._replaceUpdateOperationHandle(_,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),k.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),k.WIDGET),n.on(`key-down`,e=>{e.key===A.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),c(l),c(s),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();if(this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0){a.complete();return}i.graphics=n}}),o=!1,s=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET)],l=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:s}=a.module,l=new o({view:n,graphic:e}),u=ye(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(u)}).`),null;let d=t.reshapeOptions,f=new s({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{c(p),Q(n,f),l.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.redo(),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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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()=>{t.toggleToolOnClick!==!1&&await this._replaceUpdateOperationHandle(m,t,()=>this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0))}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{c(s),c(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];if(this.updateGraphics.removeAll(),!await this._replaceUpdateOperationHandle(a,n,()=>this._setupTransformOrReshape2DOperation(t,`transform`,n,r)))return}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),!$(i)&&(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(c(s),s=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),k.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET),r.on(`key-up`,e=>{if(e.key===A.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET)],s=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(A.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions:this._operationToolOptions,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,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},v)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;if(i.native?.shiftKey&&this.hasGraphic(r)){i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r));return}t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}async _replaceUpdateOperationHandle(e,t,n){let r=this._operationContext;e.onEnd(),e.destroy();let i=await this._updatingHandles.addPromise(n());return!i||$(i)||r!==this._operationContext?(i&&!$(i)&&(i.onEnd(),i.destroy()),this._destroyOperationContext(r),!1):(this._setUpdateOperationHandle(i,t),!0)}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=L(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;if(a){t.stopPropagation(),await a;return}this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===A.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===A.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===A.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&A.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),d(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){u.getLogger(this).error(new i(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_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(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??pe(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this._operationToolOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(l(o));let c=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(_(()=>this._getGraphicSymbolFromTool(r),e=>c.symbol=e)),this._set(`createGraphic`,c),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return y(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;if(!e){this._logMissingView();return}f(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await g(y(()=>e?.ready),this._viewReadyAbortController.signal)}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Re,K(`layer`))}};e([b()],G.prototype,`_defaultSnappingManager`,void 0),e([b()],G.prototype,`_operationContext`,void 0),e([b()],G.prototype,`_layerAdapter`,null),e([b()],G.prototype,`_pluginManager`,void 0),e([b({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([b()],G.prototype,`_operationHandle`,void 0),e([b({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([b({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([b()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([b({readOnly:!0})],G.prototype,`activeTool`,null),e([b()],G.prototype,`geometrySimplificationInProgress`,null),e([b({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([b()],G.prototype,`activeTooltip`,null),e([b({types:E})],G.prototype,`activeFillSymbol`,void 0),e([b()],G.prototype,`activeLineSymbol`,void 0),e([b()],G.prototype,`activeVertexSymbol`,void 0),e([b()],G.prototype,`allowDeleteKey`,void 0),e([b({readOnly:!0})],G.prototype,`createGraphic`,null),e([b()],G.prototype,`defaultCreateOptions`,null),e([b()],G.prototype,`defaultUpdateOptions`,null),e([b()],G.prototype,`activeUpdateOptions`,void 0),e([b({type:M,nonNullable:!0})],G.prototype,`labelOptions`,null),e([b()],G.prototype,`layer`,void 0),e([b({types:E})],G.prototype,`pointSymbol`,void 0),e([b({types:E})],G.prototype,`polygonSymbol`,void 0),e([b({types:E})],G.prototype,`polylineSymbol`,void 0),e([b()],G.prototype,`meshSymbol`,void 0),e([b({type:T})],G.prototype,`textSymbol`,null),e([b({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([b()],G.prototype,`snappingManager`,null),e([b({readOnly:!0})],G.prototype,`state`,null),e([b()],G.prototype,`toolTransitionInProgress`,null),e([b({type:Se,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([b({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([b()],G.prototype,`updateOnGraphicClick`,void 0),e([b()],G.prototype,`useViewOptions`,void 0),e([b()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([b()],G.prototype,`updating`,null),e([b()],G.prototype,`creationMode`,void 0),e([b({type:Ce,nonNullable:!0})],G.prototype,`valueOptions`,null),e([b({types:E})],G.prototype,`vertexSymbol`,void 0),e([b({value:null})],G.prototype,`view`,null),e([b({constructOnly:!0,type:N})],G.prototype,`sketchOptions`,void 0),e([b()],G.prototype,`useLegacyCreateTools`,void 0),e([b()],G.prototype,`isUsingLegacyCreateTools`,null),e([b()],G.prototype,`pluginManager`,null),e([b()],G.prototype,`drawTool`,null),e([b()],G.prototype,`activePluginConfigurations`,null),e([b()],G.prototype,`rootPlugins`,null),e([b()],G.prototype,`effectiveAvailablePlugins`,null),e([b()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([b()],G.prototype,`multiplePluginsActive`,null),G=e([re(`esri.widgets.Sketch.SketchViewModel`)],G);const Re=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function ze(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
|
package/widgets/Sketch.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ import type { LineSymbol3DProperties } from "../symbols/LineSymbol3D.js";
|
|
|
32
32
|
import type { SimpleLineSymbolProperties } from "../symbols/SimpleLineSymbol.js";
|
|
33
33
|
import type { VisibleElementsProperties } from "./Sketch/VisibleElements.js";
|
|
34
34
|
|
|
35
|
-
export interface SketchProperties extends WidgetProperties, Partial<Pick<Sketch, "availableCreateTools" | "creationMode" | "layer" | "layout" | "scale" | "toolbarKind" | "useLegacyCreateTools" | "view">> {
|
|
35
|
+
export interface SketchProperties extends WidgetProperties, Partial<Pick<Sketch, "availableCreateTools" | "creationMode" | "layer" | "layout" | "scale" | "toolbarKind" | "useLegacyCreateTools" | "useViewOptions" | "view">> {
|
|
36
36
|
/**
|
|
37
37
|
* Default create options set for the Sketch widget.
|
|
38
38
|
*
|
|
@@ -668,6 +668,32 @@ export default class Sketch extends Widget<SketchProperties> {
|
|
|
668
668
|
* @since 5.0
|
|
669
669
|
*/
|
|
670
670
|
accessor useLegacyCreateTools: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* Indicates whether to use the snapping, tooltip, display-unit, and input-unit options configured through
|
|
673
|
+
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
674
|
+
*
|
|
675
|
+
* When `true`, snapping and tooltip options are inherited from the view. Options specified through
|
|
676
|
+
* [snappingOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#snappingOptions) and [tooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#tooltipOptions) are preserved but ignored.
|
|
677
|
+
* When `false`, those options are used instead.
|
|
678
|
+
*
|
|
679
|
+
* While this property is `true`, snapping controls and the tooltip toggle are hidden from the settings menu
|
|
680
|
+
* because these options are inherited from the view.
|
|
681
|
+
*
|
|
682
|
+
* Explicit units specified through [valueOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#valueOptions) override the units inherited from the
|
|
683
|
+
* view for the corresponding measurement type, such as length or area, without changing the units configured
|
|
684
|
+
* in the view. Setting an explicit unit to `null` or `undefined` restores inheritance for that measurement type.
|
|
685
|
+
*
|
|
686
|
+
* Label [options](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#labelOptions) and
|
|
687
|
+
* [direction mode](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/#directionMode) are not inherited from the view.
|
|
688
|
+
*
|
|
689
|
+
* Changes to this property apply when the next create or update operation starts, not to an operation already
|
|
690
|
+
* in progress.
|
|
691
|
+
*
|
|
692
|
+
* @default false
|
|
693
|
+
* @beta
|
|
694
|
+
* @since 5.2
|
|
695
|
+
*/
|
|
696
|
+
accessor useViewOptions: boolean;
|
|
671
697
|
/**
|
|
672
698
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
673
699
|
*
|
package/widgets/Sketch.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as n}from"../core/arrayUtils.js";import{deprecateWidget as r}from"../core/deprecate.js";import{handlesGroup as i}from"../core/handleUtils.js";import a from"../core/Logger.js";import{removeMaybe as o,destroyMaybe as s}from"../core/maybe.js";import{ignoreAbortErrors as c}from"../core/promiseUtils.js";import{watch as l,syncAndInitial as u,when as d}from"../core/reactiveUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{symbolTypes as m}from"../symbols/support/typeUtils.js";import h from"../views/interactive/sketch/SketchLabelOptions.js";import g from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import v from"./Widget.js";import y from"./Sketch/SketchViewModel.js";import b from"./Sketch/VisibleElements.js";import x from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{connectDelayedLoading as C}from"./support/loaderUtils.js";import w from"./support/SelectionToolbar.js";import T from"./support/SketchTooltipControls.js";import E from"./support/SnappingControls.js";import{tsx as D,messageBundle as O,vmEvent as k}from"./support/widget.js";import A from"./support/SelectionToolbar/VisibleElements.js";import j from"./support/SketchTooltipControls/VisibleElements.js";const M=`esri-sketch`,N={base:M,vertical:`${M}--vertical`,docked:`${M}-bar`,floating:`${M}-pad`,chipHorizontal:`${M}__selection-count-chip--horizontal`,chipVertical:`${M}__selection-count-chip--vertical`,chipVerticalSmall:`${M}__selection-count-chip--vertical--s`,popoverWrapper:`${M}__popover-wrapper`,simplificationProgressLoader:`${M}__simplification-progress-loader`},P={point:`pin`,polyline:`line`,polygon:`polygon`,rectangle:`rectangle`,circle:`circle`,multipoint:`pins`,mesh:`3d-building`,freehandPolygon:`freehand-area`,freehandPolyline:`freehand`,text:`text`};let F=class extends v{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=[`point`,`polyline`,`polygon`,`rectangle`,`circle`],this.customToolOptions=null,this.customActions=null,this.toolbarKind=`floating`,this.contextualToolLocation=`separate`,this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new b,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._effectiveRenderStateCache=new Map,this._calcitePopoverReferenceElement=null,this._relativeLocation=`top`,this._popoverOpen=!1,this._showSimplificationProgress=!1,this._clickedWhileTemporarilyDisabled=!1,e?.suppressDeprecationWarning!==!0&&(this.announceDeprecation=()=>{r(a.getLogger(this),`Sketch`,`arcgis-sketch`,{version:`5.0`})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new y({creationMode:e?.creationMode??`continuous`,useLegacyCreateTools:e?.useLegacyCreateTools??e?.view?.type===`3d`})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){let{layer:e,view:t}=this,n=new w({persistSelection:!1,visibleElements:new A({chip:!1,lassoTool:!0,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:!0}),view:t,sources:e?[e]:null,scale:this.scale,disabled:this.state===`disabled`||this._hasLongRunningOperation});this.addHandles([l(()=>this.viewModel,e=>{this._viewModelHandlesGroup=o(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=i([e.on(`delete`,e=>this.emit(`delete`,e)),l(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),l(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),l(()=>e.state,()=>{this.notifyChange(`state`),this._syncSelectionToolbarDisabledState()}),l(()=>e.geometrySimplificationInProgress,e=>{e||(this._clickedWhileTemporarilyDisabled=!1),this._syncSelectionToolbarDisabledState()}),C({getLoading:()=>e.geometrySimplificationInProgress,setEffectiveLoading:e=>{this._showSimplificationProgress=e,this._syncSelectionToolbarDisabledState()}})]))},u),d(()=>n.activeOperation,()=>{this.viewModel.cancel(),this._activeCustomToolOptions=null}),n.on(`complete`,e=>this._onSelectionOperationComplete(e)),l(()=>{let{visibleElements:{selectionTools:e}}=this;return{lassoTool:!!e?.[`lasso-selection`],rectangleTool:!!e?.[`rectangle-selection`]}},e=>{Object.assign(n.visibleElements,e)},u)]),this._selectionToolbar=n,this._syncSelectionToolbarDisabledState()}loadDependencies(){return S({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=o(this._viewModelHandlesGroup)}get activeTool(){let e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case`lasso`:return`lasso-selection`;case`rectangle`:return`rectangle-selection`;case`default`:return`custom-selection`}let{availableCreateTools:t}=this,{activeTool:n,activeCreateToolDrawMode:r}=this.viewModel;return n===`polygon`&&r===`freehand`&&t?.includes(`freehandPolygon`)?`freehandPolygon`:n===`polyline`&&r===`freehand`&&t?.includes(`freehandPolyline`)?`freehandPolyline`:this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return`pencil`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set(`layout`,e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set(`scale`,e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?`active`:this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){let t=this._get(`viewModel`);e!==t&&(t&&t===this._defaultViewModel&&s(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set(`viewModel`,e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get settingsManager(){return this.viewModel.settingsManager}get _effectiveAvailableCreateTools(){return this._getEffectiveValue(`availableCreateTools`,()=>{let e=this.viewModel.effectiveAvailablePlugins;return e?.length?e:this._visibleCreateTools})}get _effectiveUpdateGraphicsCount(){return this._getEffectiveValue(`updateGraphicsCount`,()=>this.updateGraphics.length)}get _effectiveFirstPluginWithSwappableLeaf(){return this._getEffectiveValue(`firstPluginWithSwappableLeaf`,()=>this.viewModel.firstPluginWithSwappableLeaf)}get _effectiveActivePluginUniqueIds(){return this._getEffectiveValue(`activePluginUniqueIds`,()=>{let e=this.viewModel.drawTool?.pluginStack.filter(e=>!e.configuration?.hidden).map(e=>e.configuration?.uniqueId).filter(n);return e?new Set(e):new Set})}get _isEffectiveRenderStateFrozen(){let{viewModel:e}=this;return e.toolTransitionInProgress||e.geometrySimplificationInProgress}get _visibleCreateTools(){let{availableCreateTools:e,view:t,visibleElements:n}=this,r=e?.filter(e=>!!n.createTools?.[e]);return t?.type===`3d`?r?.filter(e=>e!==`multipoint`):r}_getEffectiveValue(e,t){if(!this._isEffectiveRenderStateFrozen||!this._effectiveRenderStateCache.has(e)){let n=t();return this._effectiveRenderStateCache.set(e,n),n}return this._effectiveRenderStateCache.get(e)}create(e,t,n){let r=n?.createOptions??t;return this._activeCustomToolOptions=n,c(this.viewModel.create(e,r))}update(e,t){return c(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){let{toolbarKind:e,layout:t,scale:n}=this;return D(`div`,null,D(`div`,{classes:{[N.base]:!0,[N.floating]:e===`floating`,[N.docked]:e===`docked`,[N.vertical]:t===`vertical`}},D(x,{barStyle:e,layout:t,scale:n},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup(),this._renderSimplificationProgressItemGroupInline()),this._renderSelectionSetToolbar(),this._renderSimplificationProgressToolbar(),this._renderSettingsMenuPopover()))}_renderSimplificationProgressToolbar(){if(this.contextualToolLocation!==`separate`)return;let e=this._renderSimplificationProgressItemGroup();if(e)return D(x,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e)}_renderSimplificationProgressItemGroupInline(){if(this.contextualToolLocation!==`separate`)return this._renderSimplificationProgressItemGroup()}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this._effectiveFirstPluginWithSwappableLeaf)return this._renderBackButton();let e=this.customActions?.filter(e=>e.position===`selection-toolbar`);return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`selectionTools`)??!0,"group-kind":`split-button`,key:`selection-split-button`,priority:this.groupCollapsePriorities?.get(`selectionTools`)??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){let{messagesCommon:e,snappingOptions:t,view:n,viewModel:r,visibleElements:i}=this;if(!this._calcitePopoverReferenceElement)return;let a={directionModePicker:i.directionModePicker,labelsToggle:i.labelsToggle,tooltipsToggle:i.tooltipsToggle},o=this.layout===`horizontal`?this._relativeLocation===`top`?`bottom-end`:`top-end`:`right-end`;return D(`calcite-popover`,{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,key:`${this.id}-settings`,label:e.settings,open:this._popoverOpen,overlayPositioning:`fixed`,placement:o,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},D(`div`,{class:N.popoverWrapper},Object.values(a).includes(!0)?D(T,{sketchOptions:r.sketchOptions,view:n,visibleElements:new j(a)}):void 0,i.snappingControls&&n&&t?D(E,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:n,visibleElements:i.snappingControlsElements}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if(this.contextualToolLocation!==`separate`)return;let e=this._renderSelectionSetItemGroup();if(e?.length)return D(x,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e)}_renderSimplificationProgressItemGroup(){if(!this.visibleElements.geometrySimplificationActivityIndicator||!this._showSimplificationProgress)return;let e=`${this.messages.finalizingDrawingTitle}`;return D(`div`,{"group-kind":`measured-content-group`,key:`simplification-progress-group`,slot:`actions-end`},D(`calcite-action`,{"data-testid":`simplification-progress`,key:`simplification-progress`,scale:this.scale,text:e,title:e},D(`calcite-loader`,{class:N.simplificationProgressLoader,inline:!0,label:e,scale:this.scale,type:`indeterminate`})))}_renderSelectionSetItemGroupInline(){return this.contextualToolLocation===`separate`?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`undoRedo`)??!0,"group-kind":`split-button`,key:`undo-redo-menu`,priority:this.groupCollapsePriorities?.get(`undoRedo`)??10,slot:`actions-end`},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){let e=[],t=[];this.customActions?.forEach(n=>{n.position===`settings-before`?t.push(n):n.position===`settings-after`&&e.push(n)});let r=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(n);if(r.length)return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`settings`)??!1,"group-kind":`overflow-group`,key:`settings-menu`,priority:this.groupCollapsePriorities?.get(`settings`)??1e3,slot:`actions-end`},r)}_renderSelectionSetItemGroup(){if(!this._effectiveUpdateGraphicsCount)return[];let e=this.contextualToolLocation===`inline-end`?`actions-end`:void 0,t=this.customActions?.filter(e=>e.position===`before-selection-set`),n=this.customActions?.filter(e=>e.position===`after-selection-set`),r=this.groupCollapsePriorities?.get(`selectionSet`)??100;return[D(`div`,{"group-kind":`measured-content`,key:`selection-count-chip-group`,priority:r,slot:e},this._renderFeatureCountChip()),D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`selectionSet`)??!1,"group-kind":`overflow-group`,key:`selection-set-tool-group`,priority:r,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),n?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this._getEffectiveValue(`updateOnGraphicClick`,()=>this.viewModel.updateOnGraphicClick))return[];let{messages:e}=this;return this._renderToolbarItem({id:`pointer-select`,text:e.selectFeature,icon:`cursor`,onclick:this._activateDefaultSelectTool,active:this._getEffectiveValue(`state`,()=>this.state)===`ready`})}_renderBackButton(){let{isUsingLegacyCreateTools:e}=this,t=this._getEffectiveValue(`multiplePluginsActive`,()=>this.viewModel.multiplePluginsActive),n=this._effectiveFirstPluginWithSwappableLeaf,r=this._getEffectiveValue(`rootPlugins`,()=>this.viewModel.rootPlugins);if(!(e||!t||!n||!r||r.length<2&&r.includes(n)&&!this.visibleElements.singlePluginBackButton))return D(`div`,{"allow-collapse":!1,"group-kind":`overflow-group`,key:`selection-split-button`},D(`calcite-action`,{disabled:this.state===`disabled`||this._hasLongRunningOperation,icon:`chevron-left`,iconFlipRtl:!0,scale:this.scale,text:this.messagesCommon.back,onclick:()=>{this.shouldIgnoreClick()||this.viewModel?.cancel()}}))}_renderCreateToolActionGroup(){let e=this._effectiveFirstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,n=(t?.filter(e=>typeof e==`string`))?.map(e=>this._renderCreateToolItem(e)),r=t?.filter(e=>typeof e!=`string`).map(e=>this._renderCreateToolItem(e));return[n?.length||e?.length||r?.length?D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`createTools`)??!0,"group-kind":`overflow-group`,key:`create-tools-group`,priority:this.groupCollapsePriorities?.get(`createTools`)??100},n,e,r):void 0]}_renderCreateToolItem(e){return typeof e==`string`?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){let{icon:t,localizationKey:n,uniqueId:r,hidden:i}=e;if(i)return[];let a=this.messages.digitizers?.[n]??n,o=!this._activeCustomToolOptions&&this._effectiveActivePluginUniqueIds.has(r);return this._renderToolbarItem({id:`${n}-button`,text:a,icon:t,onclick:()=>this._activatePlugin([e]),active:o})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:P[e],onclick:()=>this._activateCreateTool(e),active:this._getEffectiveValue(`activeTool`,()=>this.activeTool)===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){let{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:`undo-button`,text:this.messages.undo,icon:`undo`,disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:`redo-button`,text:this.messages.redo,icon:`redo`,disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:`settings-menu-action`,text:this.messagesCommon.settings,icon:`gear`,active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];let{layout:e,messages:n,scale:r,id:i}=this,a=this._effectiveUpdateGraphicsCount,o=t(n.selectedCount,{count:a}),s=r===`l`?999:99,c=a>s?t(n.selectedCountTruncated,{truncated:s}):a,l=r!==`l`&&e===`vertical`,u=l?`${i}-selection-chip-small`:`${i}-selection-chip`;return[l?D(`span`,{classes:{[N.chipVertical]:!0,[N.chipVerticalSmall]:this.scale===`s`},id:u,tabIndex:0,title:o},c):D(`calcite-chip`,{appearance:`outline`,class:e===`horizontal`?N.chipHorizontal:N.chipVertical,id:u,kind:`brand`,label:o,scale:r===`l`?`m`:`s`,tabIndex:0,title:e===`vertical`?o:void 0},e===`vertical`?c:o)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];let{messages:e}=this;return this._renderToolbarItem({id:`duplicate`,text:this._effectiveUpdateGraphicsCount>1?e.duplicateFeatures:e.duplicateFeature,icon:`copy`,onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];let{messages:e}=this,t=this._effectiveUpdateGraphicsCount>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:`delete`,text:t,icon:`trash`,onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:n,disabled:r,onclick:i,active:a,flipRTL:o,afterCreate:s,afterUpdate:c,afterRemoved:l}){let u=`${this.id}-${e}`,d=i?()=>{this.shouldIgnoreClick()||i.call(this)}:void 0;return[D(`calcite-action`,{active:a,afterCreate:s,afterRemoved:l,afterUpdate:c,bind:this,"data-testid":e,disabled:r||this.state===`disabled`||this._hasLongRunningOperation,icon:n,iconFlipRtl:o??!1,id:u,key:e,scale:this.scale,text:t,title:t,onclick:d})]}get _hasLongRunningOperation(){return this._showSimplificationProgress||this._clickedWhileTemporarilyDisabled}_remeasurePopoverSizes(e){try{let t=this._calcitePopoverReferenceElement,n=e.parentElement,r=this?.view?.container?.getBoundingClientRect(),i=n?.style;if(!n||!r||!i||!this.view?.container?.contains(n)||!t)return;let{bottom:a,top:o}=t.getBoundingClientRect();if(this.layout===`horizontal`){let e=a<r.height/2;e!==(this._relativeLocation===`top`)&&(this._relativeLocation=e?`top`:`bottom`),e?(i?.setProperty(`--sketch-view-height-offset`,`${a-r.top}px`),i?.setProperty(`--sketch-view-margin-offset`,`30px`)):(i?.setProperty(`--sketch-view-height-offset`,`${r.bottom-o}px`),i?.setProperty(`--sketch-view-margin-offset`,`15px`))}else this.layout===`vertical`&&(i.setProperty(`--sketch-view-height-offset`,`15px`),i.setProperty(`--sketch-view-margin-offset`,`15px`));let s=e.shadowRoot?.querySelector(`div.header`)?.getBoundingClientRect().height;i.setProperty(`--sketch-popover-header-offset`,`${s}px`)}catch(e){a.getLogger(this.declaredClass).warnOnce(`Sketch failed to lay out settings menu.`,e)}}_activateCreateTool(e,t,n){let r=this._activeCustomToolOptions;if(n||r){if(n?.toolKey===r?.toolKey){this.cancel();return}}else if(this.activeTool===e){this.cancel();return}this._selectionToolbar?.cancel(),this.create(e,t,n)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){let e=this.duplicate(),t=this.viewModel.activeTool;(t===`transform`||t===`reshape`)&&this.update(e,{tool:t})}shouldIgnoreClick(){return this._clickedWhileTemporarilyDisabled?!0:this.viewModel.geometrySimplificationInProgress?(this._clickedWhileTemporarilyDisabled=!0,this._syncSelectionToolbarDisabledState(),!0):!1}_onSelectionOperationComplete(e){let{viewModel:{defaultUpdateOptions:t}}=this,{selection:n}=e;if(!e.aborted&&n.length){let e=t.tool,r=n.length>1&&e===`reshape`?`transform`:e;this.update(n,{...t,tool:r})}this.notifyChange(`state`)}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){this.activeTool&&e===this._popoverElement&&this.view?.focus()}_syncSelectionToolbarDisabledState(){this._selectionToolbar&&(this._selectionToolbar.disabled=this.state===`disabled`||this._hasLongRunningOperation)}};e([f()],F.prototype,`activeTool`,null),e([f({readOnly:!0})],F.prototype,`activeTooltip`,null),e([f({cast:e=>{if(!e?.length)return null;let t=new Set([`point`,`polyline`,`polygon`,`rectangle`,`circle`,`multipoint`,`freehandPolyline`,`freehandPolygon`,`mesh`,`text`]);return e.filter(e=>t.has(e))}})],F.prototype,`availableCreateTools`,void 0),e([f({readOnly:!0})],F.prototype,`createGraphic`,null),e([f()],F.prototype,`creationMode`,null),e([f()],F.prototype,`customToolOptions`,void 0),e([f()],F.prototype,`customActions`,void 0),e([f()],F.prototype,`defaultCreateOptions`,null),e([f()],F.prototype,`defaultUpdateOptions`,null),e([f()],F.prototype,`icon`,null),e([f()],F.prototype,`label`,null),e([f({type:h})],F.prototype,`labelOptions`,null),e([f()],F.prototype,`layer`,null),e([f({type:[`horizontal`,`vertical`],value:`horizontal`})],F.prototype,`layout`,null),e([f({types:m})],F.prototype,`pointSymbol`,null),e([f({types:m})],F.prototype,`polygonSymbol`,null),e([f({types:m})],F.prototype,`polylineSymbol`,null),e([f()],F.prototype,`textSymbol`,null),e([f({value:`m`})],F.prototype,`scale`,null),e([f()],F.prototype,`toolbarKind`,void 0),e([f()],F.prototype,`contextualToolLocation`,void 0),e([f()],F.prototype,`groupCollapsePriorities`,void 0),e([f()],F.prototype,`groupAllowCollapseOptions`,void 0),e([f(),O(`esri/widgets/Sketch/t9n/Sketch`)],F.prototype,`messages`,void 0),e([f(),O(`esri/t9n/common`)],F.prototype,`messagesCommon`,void 0),e([f()],F.prototype,`snappingOptions`,null),e([f()],F.prototype,`state`,null),e([f({type:g})],F.prototype,`tooltipOptions`,null),e([f({readOnly:!0})],F.prototype,`updateGraphics`,null),e([f({type:_,nonNullable:!0})],F.prototype,`valueOptions`,null),e([f()],F.prototype,`view`,null),e([f({type:y}),k([`create`,`duplicate`,`update`,`undo`,`redo`])],F.prototype,`viewModel`,null),e([f({type:b,nonNullable:!0})],F.prototype,`visibleElements`,void 0),e([f()],F.prototype,`useLegacyCreateTools`,null),e([f()],F.prototype,`isUsingLegacyCreateTools`,null),e([f()],F.prototype,`settingsManager`,null),e([f()],F.prototype,`_effectiveAvailableCreateTools`,null),e([f()],F.prototype,`_effectiveUpdateGraphicsCount`,null),e([f()],F.prototype,`_effectiveFirstPluginWithSwappableLeaf`,null),e([f()],F.prototype,`_effectiveActivePluginUniqueIds`,null),e([f()],F.prototype,`_isEffectiveRenderStateFrozen`,null),e([f()],F.prototype,`_defaultViewModel`,void 0),e([f()],F.prototype,`_activeCustomToolOptions`,void 0),e([f()],F.prototype,`_calcitePopoverReferenceElement`,void 0),e([f()],F.prototype,`_hasLongRunningOperation`,null),e([f()],F.prototype,`_relativeLocation`,void 0),e([f()],F.prototype,`_popoverOpen`,void 0),e([f()],F.prototype,`_showSimplificationProgress`,void 0),e([f()],F.prototype,`_clickedWhileTemporarilyDisabled`,void 0),F=e([p(`esri.widgets.Sketch`)],F);const I=F;export{I as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as n}from"../core/arrayUtils.js";import{deprecateWidget as r}from"../core/deprecate.js";import{handlesGroup as i}from"../core/handleUtils.js";import a from"../core/Logger.js";import{removeMaybe as o,destroyMaybe as s}from"../core/maybe.js";import{ignoreAbortErrors as c}from"../core/promiseUtils.js";import{watch as l,syncAndInitial as u,when as d}from"../core/reactiveUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{symbolTypes as m}from"../symbols/support/typeUtils.js";import h from"../views/interactive/sketch/SketchLabelOptions.js";import g from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import v from"./Widget.js";import y from"./Sketch/SketchViewModel.js";import b from"./Sketch/VisibleElements.js";import x from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{connectDelayedLoading as C}from"./support/loaderUtils.js";import w from"./support/SelectionToolbar.js";import T from"./support/SketchTooltipControls.js";import E from"./support/SnappingControls.js";import{tsx as D,messageBundle as O,vmEvent as k}from"./support/widget.js";import A from"./support/SelectionToolbar/VisibleElements.js";import j from"./support/SketchTooltipControls/VisibleElements.js";const M=`esri-sketch`,N={base:M,vertical:`${M}--vertical`,docked:`${M}-bar`,floating:`${M}-pad`,chipHorizontal:`${M}__selection-count-chip--horizontal`,chipVertical:`${M}__selection-count-chip--vertical`,chipVerticalSmall:`${M}__selection-count-chip--vertical--s`,popoverWrapper:`${M}__popover-wrapper`,simplificationProgressLoader:`${M}__simplification-progress-loader`},P={point:`pin`,polyline:`line`,polygon:`polygon`,rectangle:`rectangle`,circle:`circle`,multipoint:`pins`,mesh:`3d-building`,freehandPolygon:`freehand-area`,freehandPolyline:`freehand`,text:`text`};let F=class extends v{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=[`point`,`polyline`,`polygon`,`rectangle`,`circle`],this.customToolOptions=null,this.customActions=null,this.toolbarKind=`floating`,this.contextualToolLocation=`separate`,this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new b,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._effectiveRenderStateCache=new Map,this._calcitePopoverReferenceElement=null,this._relativeLocation=`top`,this._popoverOpen=!1,this._showSimplificationProgress=!1,this._clickedWhileTemporarilyDisabled=!1,e?.suppressDeprecationWarning!==!0&&(this.announceDeprecation=()=>{r(a.getLogger(this),`Sketch`,`arcgis-sketch`,{version:`5.0`})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new y({creationMode:e?.creationMode??`continuous`,useLegacyCreateTools:e?.useLegacyCreateTools??e?.view?.type===`3d`})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){let{layer:e,view:t}=this,n=new w({persistSelection:!1,visibleElements:new A({chip:!1,lassoTool:!0,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:!0}),view:t,sources:e?[e]:null,scale:this.scale,disabled:this.state===`disabled`||this._hasLongRunningOperation});this.addHandles([l(()=>this.viewModel,e=>{this._viewModelHandlesGroup=o(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=i([e.on(`delete`,e=>this.emit(`delete`,e)),l(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),l(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),l(()=>e.state,()=>{this.notifyChange(`state`),this._syncSelectionToolbarDisabledState()}),l(()=>e.geometrySimplificationInProgress,e=>{e||(this._clickedWhileTemporarilyDisabled=!1),this._syncSelectionToolbarDisabledState()}),C({getLoading:()=>e.geometrySimplificationInProgress,setEffectiveLoading:e=>{this._showSimplificationProgress=e,this._syncSelectionToolbarDisabledState()}})]))},u),d(()=>n.activeOperation,()=>{this.viewModel.cancel(),this._activeCustomToolOptions=null}),n.on(`complete`,e=>this._onSelectionOperationComplete(e)),l(()=>{let{visibleElements:{selectionTools:e}}=this;return{lassoTool:!!e?.[`lasso-selection`],rectangleTool:!!e?.[`rectangle-selection`]}},e=>{Object.assign(n.visibleElements,e)},u)]),this._selectionToolbar=n,this._syncSelectionToolbarDisabledState()}loadDependencies(){return S({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=o(this._viewModelHandlesGroup)}get activeTool(){let e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case`lasso`:return`lasso-selection`;case`rectangle`:return`rectangle-selection`;case`default`:return`custom-selection`}let{availableCreateTools:t}=this,{activeTool:n,activeCreateToolDrawMode:r}=this.viewModel;return n===`polygon`&&r===`freehand`&&t?.includes(`freehandPolygon`)?`freehandPolygon`:n===`polyline`&&r===`freehand`&&t?.includes(`freehandPolyline`)?`freehandPolyline`:this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return`pencil`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set(`layout`,e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set(`scale`,e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?`active`:this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get useViewOptions(){return this.viewModel.useViewOptions}set useViewOptions(e){this.viewModel.useViewOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){let t=this._get(`viewModel`);e!==t&&(t&&t===this._defaultViewModel&&s(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set(`viewModel`,e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get settingsManager(){return this.viewModel.settingsManager}get _effectiveAvailableCreateTools(){return this._getEffectiveValue(`availableCreateTools`,()=>{let e=this.viewModel.effectiveAvailablePlugins;return e?.length?e:this._visibleCreateTools})}get _effectiveUpdateGraphicsCount(){return this._getEffectiveValue(`updateGraphicsCount`,()=>this.updateGraphics.length)}get _effectiveFirstPluginWithSwappableLeaf(){return this._getEffectiveValue(`firstPluginWithSwappableLeaf`,()=>this.viewModel.firstPluginWithSwappableLeaf)}get _effectiveActivePluginUniqueIds(){return this._getEffectiveValue(`activePluginUniqueIds`,()=>{let e=this.viewModel.drawTool?.pluginStack.filter(e=>!e.configuration?.hidden).map(e=>e.configuration?.uniqueId).filter(n);return e?new Set(e):new Set})}get _isEffectiveRenderStateFrozen(){let{viewModel:e}=this;return e.toolTransitionInProgress||e.geometrySimplificationInProgress}get _visibleCreateTools(){let{availableCreateTools:e,view:t,visibleElements:n}=this,r=e?.filter(e=>!!n.createTools?.[e]);return t?.type===`3d`?r?.filter(e=>e!==`multipoint`):r}_getEffectiveValue(e,t){if(!this._isEffectiveRenderStateFrozen||!this._effectiveRenderStateCache.has(e)){let n=t();return this._effectiveRenderStateCache.set(e,n),n}return this._effectiveRenderStateCache.get(e)}create(e,t,n){let r=n?.createOptions??t;return this._activeCustomToolOptions=n,c(this.viewModel.create(e,r))}update(e,t){return c(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){let{toolbarKind:e,layout:t,scale:n}=this;return D(`div`,null,D(`div`,{classes:{[N.base]:!0,[N.floating]:e===`floating`,[N.docked]:e===`docked`,[N.vertical]:t===`vertical`}},D(x,{barStyle:e,layout:t,scale:n},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup(),this._renderSimplificationProgressItemGroupInline()),this._renderSelectionSetToolbar(),this._renderSimplificationProgressToolbar(),this._renderSettingsMenuPopover()))}_renderSimplificationProgressToolbar(){if(this.contextualToolLocation!==`separate`)return;let e=this._renderSimplificationProgressItemGroup();if(e)return D(x,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e)}_renderSimplificationProgressItemGroupInline(){if(this.contextualToolLocation!==`separate`)return this._renderSimplificationProgressItemGroup()}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this._effectiveFirstPluginWithSwappableLeaf)return this._renderBackButton();let e=this.customActions?.filter(e=>e.position===`selection-toolbar`);return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`selectionTools`)??!0,"group-kind":`split-button`,key:`selection-split-button`,priority:this.groupCollapsePriorities?.get(`selectionTools`)??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){let{messagesCommon:e,snappingOptions:t,useViewOptions:n,view:r,viewModel:i,visibleElements:a}=this;if(!this._calcitePopoverReferenceElement)return;let o={directionModePicker:a.directionModePicker,labelsToggle:a.labelsToggle,tooltipsToggle:!n&&a.tooltipsToggle},s=this.layout===`horizontal`?this._relativeLocation===`top`?`bottom-end`:`top-end`:`right-end`;return D(`calcite-popover`,{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,key:`${this.id}-settings`,label:e.settings,open:this._popoverOpen,overlayPositioning:`fixed`,placement:s,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},D(`div`,{class:N.popoverWrapper},Object.values(o).includes(!0)?D(T,{sketchOptions:i.sketchOptions,view:r,visibleElements:new j(o)}):void 0,!n&&a.snappingControls&&r&&t?D(E,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:r,visibleElements:a.snappingControlsElements}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if(this.contextualToolLocation!==`separate`)return;let e=this._renderSelectionSetItemGroup();if(e?.length)return D(x,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e)}_renderSimplificationProgressItemGroup(){if(!this.visibleElements.geometrySimplificationActivityIndicator||!this._showSimplificationProgress)return;let e=`${this.messages.finalizingDrawingTitle}`;return D(`div`,{"group-kind":`measured-content-group`,key:`simplification-progress-group`,slot:`actions-end`},D(`calcite-action`,{"data-testid":`simplification-progress`,key:`simplification-progress`,scale:this.scale,text:e,title:e},D(`calcite-loader`,{class:N.simplificationProgressLoader,inline:!0,label:e,scale:this.scale,type:`indeterminate`})))}_renderSelectionSetItemGroupInline(){return this.contextualToolLocation===`separate`?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`undoRedo`)??!0,"group-kind":`split-button`,key:`undo-redo-menu`,priority:this.groupCollapsePriorities?.get(`undoRedo`)??10,slot:`actions-end`},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){let e=[],t=[];this.customActions?.forEach(n=>{n.position===`settings-before`?t.push(n):n.position===`settings-after`&&e.push(n)});let r=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(n);if(r.length)return D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`settings`)??!1,"group-kind":`overflow-group`,key:`settings-menu`,priority:this.groupCollapsePriorities?.get(`settings`)??1e3,slot:`actions-end`},r)}_renderSelectionSetItemGroup(){if(!this._effectiveUpdateGraphicsCount)return[];let e=this.contextualToolLocation===`inline-end`?`actions-end`:void 0,t=this.customActions?.filter(e=>e.position===`before-selection-set`),n=this.customActions?.filter(e=>e.position===`after-selection-set`),r=this.groupCollapsePriorities?.get(`selectionSet`)??100;return[D(`div`,{"group-kind":`measured-content`,key:`selection-count-chip-group`,priority:r,slot:e},this._renderFeatureCountChip()),D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`selectionSet`)??!1,"group-kind":`overflow-group`,key:`selection-set-tool-group`,priority:r,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),n?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this._getEffectiveValue(`updateOnGraphicClick`,()=>this.viewModel.updateOnGraphicClick))return[];let{messages:e}=this;return this._renderToolbarItem({id:`pointer-select`,text:e.selectFeature,icon:`cursor`,onclick:this._activateDefaultSelectTool,active:this._getEffectiveValue(`state`,()=>this.state)===`ready`})}_renderBackButton(){let{isUsingLegacyCreateTools:e}=this,t=this._getEffectiveValue(`multiplePluginsActive`,()=>this.viewModel.multiplePluginsActive),n=this._effectiveFirstPluginWithSwappableLeaf,r=this._getEffectiveValue(`rootPlugins`,()=>this.viewModel.rootPlugins);if(!(e||!t||!n||!r||r.length<2&&r.includes(n)&&!this.visibleElements.singlePluginBackButton))return D(`div`,{"allow-collapse":!1,"group-kind":`overflow-group`,key:`selection-split-button`},D(`calcite-action`,{disabled:this.state===`disabled`||this._hasLongRunningOperation,icon:`chevron-left`,iconFlipRtl:!0,scale:this.scale,text:this.messagesCommon.back,onclick:()=>{this.shouldIgnoreClick()||this.viewModel?.cancel()}}))}_renderCreateToolActionGroup(){let e=this._effectiveFirstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,n=(t?.filter(e=>typeof e==`string`))?.map(e=>this._renderCreateToolItem(e)),r=t?.filter(e=>typeof e!=`string`).map(e=>this._renderCreateToolItem(e));return[n?.length||e?.length||r?.length?D(`div`,{"allow-collapse":this.groupAllowCollapseOptions?.get(`createTools`)??!0,"group-kind":`overflow-group`,key:`create-tools-group`,priority:this.groupCollapsePriorities?.get(`createTools`)??100},n,e,r):void 0]}_renderCreateToolItem(e){return typeof e==`string`?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){let{icon:t,localizationKey:n,uniqueId:r,hidden:i}=e;if(i)return[];let a=this.messages.digitizers?.[n]??n,o=!this._activeCustomToolOptions&&this._effectiveActivePluginUniqueIds.has(r);return this._renderToolbarItem({id:`${n}-button`,text:a,icon:t,onclick:()=>this._activatePlugin([e]),active:o})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:P[e],onclick:()=>this._activateCreateTool(e),active:this._getEffectiveValue(`activeTool`,()=>this.activeTool)===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){let{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:`undo-button`,text:this.messages.undo,icon:`undo`,disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:`redo-button`,text:this.messages.redo,icon:`redo`,disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:`settings-menu-action`,text:this.messagesCommon.settings,icon:`gear`,active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];let{layout:e,messages:n,scale:r,id:i}=this,a=this._effectiveUpdateGraphicsCount,o=t(n.selectedCount,{count:a}),s=r===`l`?999:99,c=a>s?t(n.selectedCountTruncated,{truncated:s}):a,l=r!==`l`&&e===`vertical`,u=l?`${i}-selection-chip-small`:`${i}-selection-chip`;return[l?D(`span`,{classes:{[N.chipVertical]:!0,[N.chipVerticalSmall]:this.scale===`s`},id:u,tabIndex:0,title:o},c):D(`calcite-chip`,{appearance:`outline`,class:e===`horizontal`?N.chipHorizontal:N.chipVertical,id:u,kind:`brand`,label:o,scale:r===`l`?`m`:`s`,tabIndex:0,title:e===`vertical`?o:void 0},e===`vertical`?c:o)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];let{messages:e}=this;return this._renderToolbarItem({id:`duplicate`,text:this._effectiveUpdateGraphicsCount>1?e.duplicateFeatures:e.duplicateFeature,icon:`copy`,onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];let{messages:e}=this,t=this._effectiveUpdateGraphicsCount>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:`delete`,text:t,icon:`trash`,onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:n,disabled:r,onclick:i,active:a,flipRTL:o,afterCreate:s,afterUpdate:c,afterRemoved:l}){let u=`${this.id}-${e}`,d=i?()=>{this.shouldIgnoreClick()||i.call(this)}:void 0;return[D(`calcite-action`,{active:a,afterCreate:s,afterRemoved:l,afterUpdate:c,bind:this,"data-testid":e,disabled:r||this.state===`disabled`||this._hasLongRunningOperation,icon:n,iconFlipRtl:o??!1,id:u,key:e,scale:this.scale,text:t,title:t,onclick:d})]}get _hasLongRunningOperation(){return this._showSimplificationProgress||this._clickedWhileTemporarilyDisabled}_remeasurePopoverSizes(e){try{let t=this._calcitePopoverReferenceElement,n=e.parentElement,r=this?.view?.container?.getBoundingClientRect(),i=n?.style;if(!n||!r||!i||!this.view?.container?.contains(n)||!t)return;let{bottom:a,top:o}=t.getBoundingClientRect();if(this.layout===`horizontal`){let e=a<r.height/2;e!==(this._relativeLocation===`top`)&&(this._relativeLocation=e?`top`:`bottom`),e?(i?.setProperty(`--sketch-view-height-offset`,`${a-r.top}px`),i?.setProperty(`--sketch-view-margin-offset`,`30px`)):(i?.setProperty(`--sketch-view-height-offset`,`${r.bottom-o}px`),i?.setProperty(`--sketch-view-margin-offset`,`15px`))}else this.layout===`vertical`&&(i.setProperty(`--sketch-view-height-offset`,`15px`),i.setProperty(`--sketch-view-margin-offset`,`15px`));let s=e.shadowRoot?.querySelector(`div.header`)?.getBoundingClientRect().height;i.setProperty(`--sketch-popover-header-offset`,`${s}px`)}catch(e){a.getLogger(this.declaredClass).warnOnce(`Sketch failed to lay out settings menu.`,e)}}_activateCreateTool(e,t,n){let r=this._activeCustomToolOptions;if(n||r){if(n?.toolKey===r?.toolKey){this.cancel();return}}else if(this.activeTool===e){this.cancel();return}this._selectionToolbar?.cancel(),this.create(e,t,n)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){let e=this.duplicate(),t=this.viewModel.activeTool;(t===`transform`||t===`reshape`)&&this.update(e,{tool:t})}shouldIgnoreClick(){return this._clickedWhileTemporarilyDisabled?!0:this.viewModel.geometrySimplificationInProgress?(this._clickedWhileTemporarilyDisabled=!0,this._syncSelectionToolbarDisabledState(),!0):!1}_onSelectionOperationComplete(e){let{viewModel:{defaultUpdateOptions:t}}=this,{selection:n}=e;if(!e.aborted&&n.length){let e=t.tool,r=n.length>1&&e===`reshape`?`transform`:e;this.update(n,{...t,tool:r})}this.notifyChange(`state`)}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){this.activeTool&&e===this._popoverElement&&this.view?.focus()}_syncSelectionToolbarDisabledState(){this._selectionToolbar&&(this._selectionToolbar.disabled=this.state===`disabled`||this._hasLongRunningOperation)}};e([f()],F.prototype,`activeTool`,null),e([f({readOnly:!0})],F.prototype,`activeTooltip`,null),e([f({cast:e=>{if(!e?.length)return null;let t=new Set([`point`,`polyline`,`polygon`,`rectangle`,`circle`,`multipoint`,`freehandPolyline`,`freehandPolygon`,`mesh`,`text`]);return e.filter(e=>t.has(e))}})],F.prototype,`availableCreateTools`,void 0),e([f({readOnly:!0})],F.prototype,`createGraphic`,null),e([f()],F.prototype,`creationMode`,null),e([f()],F.prototype,`customToolOptions`,void 0),e([f()],F.prototype,`customActions`,void 0),e([f()],F.prototype,`defaultCreateOptions`,null),e([f()],F.prototype,`defaultUpdateOptions`,null),e([f()],F.prototype,`icon`,null),e([f()],F.prototype,`label`,null),e([f({type:h})],F.prototype,`labelOptions`,null),e([f()],F.prototype,`layer`,null),e([f({type:[`horizontal`,`vertical`],value:`horizontal`})],F.prototype,`layout`,null),e([f({types:m})],F.prototype,`pointSymbol`,null),e([f({types:m})],F.prototype,`polygonSymbol`,null),e([f({types:m})],F.prototype,`polylineSymbol`,null),e([f()],F.prototype,`textSymbol`,null),e([f({value:`m`})],F.prototype,`scale`,null),e([f()],F.prototype,`toolbarKind`,void 0),e([f()],F.prototype,`contextualToolLocation`,void 0),e([f()],F.prototype,`groupCollapsePriorities`,void 0),e([f()],F.prototype,`groupAllowCollapseOptions`,void 0),e([f(),O(`esri/widgets/Sketch/t9n/Sketch`)],F.prototype,`messages`,void 0),e([f(),O(`esri/t9n/common`)],F.prototype,`messagesCommon`,void 0),e([f()],F.prototype,`snappingOptions`,null),e([f()],F.prototype,`state`,null),e([f({type:g})],F.prototype,`tooltipOptions`,null),e([f()],F.prototype,`useViewOptions`,null),e([f({readOnly:!0})],F.prototype,`updateGraphics`,null),e([f({type:_,nonNullable:!0})],F.prototype,`valueOptions`,null),e([f()],F.prototype,`view`,null),e([f({type:y}),k([`create`,`duplicate`,`update`,`undo`,`redo`])],F.prototype,`viewModel`,null),e([f({type:b,nonNullable:!0})],F.prototype,`visibleElements`,void 0),e([f()],F.prototype,`useLegacyCreateTools`,null),e([f()],F.prototype,`isUsingLegacyCreateTools`,null),e([f()],F.prototype,`settingsManager`,null),e([f()],F.prototype,`_effectiveAvailableCreateTools`,null),e([f()],F.prototype,`_effectiveUpdateGraphicsCount`,null),e([f()],F.prototype,`_effectiveFirstPluginWithSwappableLeaf`,null),e([f()],F.prototype,`_effectiveActivePluginUniqueIds`,null),e([f()],F.prototype,`_isEffectiveRenderStateFrozen`,null),e([f()],F.prototype,`_defaultViewModel`,void 0),e([f()],F.prototype,`_activeCustomToolOptions`,void 0),e([f()],F.prototype,`_calcitePopoverReferenceElement`,void 0),e([f()],F.prototype,`_hasLongRunningOperation`,null),e([f()],F.prototype,`_relativeLocation`,void 0),e([f()],F.prototype,`_popoverOpen`,void 0),e([f()],F.prototype,`_showSimplificationProgress`,void 0),e([f()],F.prototype,`_clickedWhileTemporarilyDisabled`,void 0),F=e([p(`esri.widgets.Sketch`)],F);const I=F;export{I as default};
|